I've written a dataport that should import a file with variable field length and a TAB as delimiter. The problem is that the file starts with a header that should not be imported. I tried to use a SKIP on both OnBeforeImportRecord and OnAfterImportRecord but it doesn't stop the error I get:
The text 'column_name' is too long. The test in de code fields can have a maximum length of 1 characters.
This error applies to a field with type Code and length 1. If I enlarge the length of the field, I get an error on another field saying I can't insert ascii in a decimal field. All due to the fact that the header line is imported, which should not happen at all.
Can anybody tell me how to skip the first line of the file that is being imported?
Comments
Filter for 1 record and read the data into a variable.
currfile.textmode(true);
currfile.read(textvarof250charlength);
Cheers,
Gus
Thank you. I made a textvar of 1024 chars length, because the first line now contains 777 characters and will contain some more in the near future.
Won't work, because there's no white line between the header and the first data line. If I try, the contents of the file is seen as integer-records, because the RecordSeparator is never found. The filter skips all file content from line 2, so only line 1 is read and that line is nog inserted.
I haven't tested this, but it should cause the file object that the dataport uses to skip to the next line.
I traded my sanity for a railgun
which was already suggested earlier:
Yes I did and it works O:)
That'll teach me to skim the text. Glad it worked at least.
Great minds think alike? hehehe
I traded my sanity for a railgun
I think this is the best solution! If you would open the dataport a year later you would see in seconds why the integer loop is there and what it should do! The best solution!
The reason why it does not work is becaurse you'll need to set the "DataItemSeparator" property to "<NewLine>".
If it was hard to write, it should be hard to understand."