josebetzy Posted March 30, 2010 Posted March 30, 2010 I would like to import a text file that is just over 6000 characters in length and needs to be imported into 526 columns. I can export to Excel 2007 and then import, but I was hoping to use FM directly. This file size is a standard record file from the government and their reference file tells us where the columns are in fixed length within this file. FM does not handle fixed length as an import option and the government will not change to a CSV or delimited file format. Any suggestions are welcomed.
bcooney Posted March 30, 2010 Posted March 30, 2010 What delimits a record? With consistency, you can parse anything. You may need to import into a temp field, then use Set field and the text functions to "break" up the data into the appropriate fields.
josebetzy Posted March 31, 2010 Author Posted March 31, 2010 The file is not delimited. We have to import from starting point to end point of the file. This establishes the field. Your idea of a temp file is excellent as then we could manage the data within FM. If I understand correctly, import the total file into one field, all 6000 characters. Then break it up using Set field and text functions. Could you please place an example of say the following file. 1AU582124567Rogers It should then look like: 1 AU 582124567 Rogers Thanks.
bcooney Posted March 31, 2010 Posted March 31, 2010 (edited) Here's a very simple example, that just counts characters and chops. You may need to use Position ( ) to "find" certain strings in the text block. Do they give you any reference points? For instance, in your example there is the string "Rogers." However, if it could be any name, how will you know the start of the next block? EDIT: Just read your first post, that columns are fixed width. So I am assuming that the column for Rogers is a fixed width. Then, it must be padded somehow, spaces? ParseExample.fp7.zip Edited March 31, 2010 by Guest
josebetzy Posted April 6, 2010 Author Posted April 6, 2010 Thanks. There is a technical reference that tells us exactly the breakdown and what type of data it represents (date, number, text, etc.). It tells us where each resulting data starts and ends. Empty spaces are padded by spaces. It is just more work for us because the file is sent in that manner. Your example helps quite a bit. Again thank you.
bcooney Posted April 6, 2010 Posted April 6, 2010 Sounds like MiddleValues ( ) is your new best friend, lol. You might also check out Trim ( ), and GetAsDate ( ). Glad I could help.
Recommended Posts
This topic is 5344 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now