>>Hi All,
>>I am importing a file and noticed that it sometimes mises a column. I have a cursor with 12 text columns and am appending in a csv file with various values. If I use
>>
APPEND FROM &mFileName TYPE csv
>>Then I miss the top row, which I need. So I've bene using this, but it gave a weird issue today. If there is any column, field, that does not have data at all then it is skipped, so field 9 becomes field 8. If even 1 field 9 has data then it is fine, but for me field 9 will be blank a lot and I rely on a calculation based on any values in field 8.
>>
APPEND FROM &mFileName delimited with ,
>>Any idea how to solve this?
>
>With CSVs, one thing I've done in the past:
>
>- Before importing, read in the file to a string variable using FILETOSTR()
>- Copy the top row (column headers/names) to a separate variable etc. This is everything up to the first carriage return/line feed combination i.e. CHR( 13 ) + CHR( 10 ) . You can then parse that variable to get the column names
>
>Then import normally using the CSV option.
>
>Actually, thinking about it you can get the headers with FILETOSTR() either before or after the CSV import, the timing doesn't matter.
A bit more playing this morning and this worked, I'd forgotten the subtleties!
APPEND FROM &mFileName DELIMITED
~M
Go raibh maith agat
~M