Options

How to import the date using Dataport ?

avgavhaneavgavhane Member Posts: 12
Dear users,
i want to import the data from more than one table using Dataport.

[-o<

Comments

  • Options
    kinekine Member Posts: 12,562
    I do not understand what you want...

    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
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    DenSterDenSter Member Posts: 8,304
    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.

    Possible:
    Table1.Rec1
    Table1.Rec2
    Table1.etc....
    
    Table2.Rec1
    Table2.Rec2
    Table2.Etc
    
    Not possible:
    Table1.Rec1
    --Table2.Rec
    --Table2.etc
    
    Table1.Rec2
    --Table2.Rec
    --Table2.etc
    
  • Options
    KarenhKarenh Member Posts: 209
    I do it all the time using variables and code.

    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.
  • Options
    DenSterDenSter Member Posts: 8,304
    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.
Sign In or Register to comment.