problm in dataport

vikasvikas Member Posts: 46
edited 2005-09-21 in Navision Financials
Hi,

I have a query regarding dataport.
I have a text(csv) file which looks like this

No,Name,Address
Item No,Quantity,Price

Now i want to push 1st line to the customer table & 2nd line to the item table.

Please help me in this regard.

Thanks,
Vikas S. Shettar

Comments

  • RobertMoRobertMo Member Posts: 484
    You can use this by setting 2 dataitems on dataport. Be sure that you set RecordSeparator (usually <NewLine>) and DataItemSeparator (usually <NewLine><NewLine>).

    If you have only 2 lines as you said your DataItemSeparator should be also <NewLine>.
               ®obi           
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  • RobertMoRobertMo Member Posts: 484
    You confuse people by posting a question on many places (I have seen at least 3). Please don't crosspost...
               ®obi           
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  • PhanPhan Member Posts: 12
    Heya,

    Is there also a way to have 1 dataport to grab the first 3 columns of a CSV file and put them in a table in Navision, and 3 other columns of the same CSV file in another table? Or do i have to write 2 dataports for this?

    Any help would be much appreciated :)
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    @Phan

    Maybe it is better to make a new topic.

    You can make 3 variables and use them in the dataport fields. In the OnAfterImportRecord() trigger you can read the second table from a variable table and store the data in the table.
  • RobertMoRobertMo Member Posts: 484
    you can create noraml dataport for first table - define only first 3 dataport fields as fields from first table.
    then define recored variable and 3 variables for 3 other fields (of proper type).
    Define this other 3 vars as 4th 5th 6th dataport field (you have to type them).
    then use proper trigger (onafterimport) to write simple code:

    rTable2.Field1 := cdMyCodeVar;
    rTable2.Field2 := tMyTextVar;
    rTable2.Field3 := dcMyDecimalVar;
    rTable2.INSERT;

    be sure to empty variables before importing otherwise value from previous rec can be inserted.

    BTW, as I can see now Mark was faster...
               ®obi           
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  • PhanPhan Member Posts: 12
    Thanks for the fast help. :D
Sign In or Register to comment.