|Subject:||Re: Action after csv import
|Date:||15 Nov 2017 00:16:16 -0400
|From:||"Kevin Zawicki" <email@example.com>
When you do the import does he csv file have a header row?
There are a dozen ways to this... some ideas.
I would open a textStream to the csv and read each line into a string and
break into an array.
Loop the textStream until eof
If the csv has a header row read line 1 and make an array.
This then is the field names and order of field in file.
Then read each row and build a dynarray and based on the array and insert
the dynarray into table B.
or just map the array to the tcursor.
No need for table A.
import to table and read the structure if it creates field names dynamically
Then use an insert query if field names are same the feild order does not
"Kevin Baker" <firstname.lastname@example.org> wrote:
>I'm trying to determine if this is possible. I need to import a csv file,
>which I know how to do. Once the csv file is imported into a temp table
>(Table A), I need to transfer the records from the Table A into another
>table (Table B), however I need to match up the fields from Table A to Table
>B. For example the first field in Table A is a Date field, which would
>the 4th field in Table B. I would do the copy from Table A to Table B via
>I would use enumFieldNames to get the field names from Table A, but really
>not sure how to move forward from this point.
>I was hoping someone might have done this in the past or could point me
>the right direction.