Import to Two Tables
the_boy_wonder
Member Posts: 8
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
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
-
Introduce table2 as a Global Var and make code in 'OnAfterImportRecord' on the table1 dataitem.Finn Landgreen-P
www.corpital.com0 -
Thanks. Are you able to advise of the code required?0
-
u can also do following (example)
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.
regardsDo you make it right, it works too!0 -
-
Hi,
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!!!!!Regards
Hanen TALBI0 -
the_boy_wonder wrote: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
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.0 -
NO, the purpose is to have in the same text file a line for the header and then lines for details.....
Example:
Sales Header
Sales Lines 1
Sales Lines 2
Sales Lines 3
Sales Lines 4Regards
Hanen TALBI0 -
we use two tables - not linked but our data is like this
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.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 322 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions