Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import File Question

Status
Not open for further replies.

Arthur1

MIS
Apr 8, 2003
28
US
Hi,

I have a flat file that has say 3 columns in it. These columns are tab delimited.
1234 | XYZ | ABC

Now column 2 or 3 can either be null or have a valid value no more then 3 characters in length.

I have set up the datastore for each of the column's data type correctly.

col 1 as Decimal
col 2 as String Length of 3
col 3 as String Length of 3

Here is the issue, if column 2 or 3 in the flat file are more then 3 characters in length the Import function treats them as a NULL value, is there a way to pick up only the first 3 characters, since for us a NULL value is actually valid? Any advice would be apprecaited, or if more cleaification is required please let me know.
 
You could increase the length of cols 2 & 3 to accept larger values from the file and add two more cols each of which has a length of 3 and then programatically set their values equal to the first three positions of cols 2 & 3 after the importfile.
Then in your processing of the datastore refer to the new columns.

Matt

"Nature forges everything on the anvil of time
 
Hi,

I figured out a pretty good (simple) solution. The ImportFile function return an Error Status if the column is more then the Data Source can handle. We were just not caputring this Error correctly. The ImportFile function returns the below. We were receiving -4 but not capturing it correctly. It actually processed the first row in the file even though there was an overall error in the file, which seems like a flaw in the PB logic to me.

0 End of file; too many rows
-1 No rows
-2 Empty file
-3 Invalid argument
-4 Invalid input
-5 Could not open the file
-6 Could not close the file
-7 Error reading the text
-8 Not a TXT file
-9 The user canceled the import
-10 Unsupported dBase file format (not version 2 or 3)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top