We need to import a CSV file into two tables.
The CSV file is auto-generated by another system and is a single row per record. Half of the row data will go to Table1, the other half to Table2.
My current Dataport is build using Table1 but I'm unsure how to code the other fields to go to Table2. THe Primary Key of the record is in both Table1 and Table2.
Any ideas?
Thanks
0
Comments
www.corpital.com
U CSV file hast, lets say 10 fields. Field 1-5 for Table A Field 6-10 and 1 for Table B. All fieldclasses are in this csv (like decimal, code, etc.)
1. create a new Dataport based on DateItem INTEGER.
2. disable the "Auto" Options
3. set the Delimiter and the Separator
4. set the FileFormat
5. add your needed Datatype variables as array (for example DecimalArray, IntegerArray, Codearray)
6. set these Arrayvaiables as SourceExpr. in the field Designer (like first DecArray[1], CodeArray[1], DecArray[2], and so on <- based on your csv structure) <- also you can use only a Text Arry but must then convert the values with evaluate if, for example an interger is needed.
7. clear in on before Import the Arrays
8. create 2 Variebals for Table A and Table B
9. in on AfterImport Trigger of Dataitem Integer you fill Table A and Table B based on your Array fields.
Instead of only using the Array variables, you can also use as Dataitem Table A and for the rest fields u use the Variables and fill then the Table B in OnAfterImport Trigger.
regards
www.corpital.com
Can I do the same in the export?????
It means can I export to a txt or a csv file from two tables?????
Thanks for help!!!!!
Hanen TALBI
Split the data into separate .txt files and import them according to NAV standards. You'll get a clear solution and more control over import transactions.
Example:
Sales Header
Sales Lines 1
Sales Lines 2
Sales Lines 3
Sales Lines 4
Hanen TALBI
Good luck then...
header1
header2
header3
header4
<space>
lines for 1
lines for 2
lines for 3
lines for 4
there's lots of post about importing sales header & lines - search the forum - you'll probably get a few good examples.
http://www.BiloBeauty.com
http://www.autismspeaks.org