Using dataports, you can only import multiple tables if you have all of the records of each table in groups of lines in your text file. If you have groups of lines structured as one record and then a group of other related records, that's not possible.
For your import file, you will have fields from your primary table and one or more related tables. For the dataport fields, select fields from the primary table as appropriate. For fields from the other tables, create variables of the same type and size. Set those variables as the dataport fields in the sequence so as to match your import file.
Create record variables for the one or more related tables.
In the onafterimport record trigger for the primary table, locate the appropriate record using SETRANGE or SETFILTER and the corresponding field(s) from the primary table. Update fields from the variables, and MODIFY the record. OR INSERT if adding new records.
Yes but that is different. You have one line with values targeted for multiple tables, and all your lines are the same. This would not work with a variable number of sales lines per sales header.
For instance, you have a sales order with one line and you have a sales order with 15 lines. The way you are describing won't work, unless you have enough fields in your dataport fields to account for that many lines.
Comments
You have one file with data for two tables? How they are organized in the file (structure of the file)?
Or you need read the file and split the data into two tables?
Pls, more info... more info = more precise answer
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Possible: Not possible:
RIS Plus, LLC
Select the primary table that you import into.
For your import file, you will have fields from your primary table and one or more related tables. For the dataport fields, select fields from the primary table as appropriate. For fields from the other tables, create variables of the same type and size. Set those variables as the dataport fields in the sequence so as to match your import file.
Create record variables for the one or more related tables.
In the onafterimport record trigger for the primary table, locate the appropriate record using SETRANGE or SETFILTER and the corresponding field(s) from the primary table. Update fields from the variables, and MODIFY the record. OR INSERT if adding new records.
For instance, you have a sales order with one line and you have a sales order with 15 lines. The way you are describing won't work, unless you have enough fields in your dataport fields to account for that many lines.
RIS Plus, LLC