xml import skipping a line

KisuKisu Member Posts: 381
I'm having a problem with xml import with purchase lines.

I'd need to skip specific lines from xml file that has entryrowtype <> 0.

I know how to skip lines but this is a little problematic.

The 3rd party xml line has this entryrowtype under child tag of the rowtags so it gets the value after first line is init.
ex:
<invoice>
-> <header>
-> <row>
--> <entryrowtype>

Is there any better solution than making a temp table for the line data and fetch the lines that way?
K.S.

Answers

  • ara3nara3n Member Posts: 9,256
    you can use xmldom and create a new xml from the original xmlfile and then send that to xmlport.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • KisuKisu Member Posts: 381
    Cheers for this again ara3n, I got it working already but good to have other solutions behind ear too. :)
    K.S.
  • Ravi_ThakkarRavi_Thakkar Member Posts: 392
    Hello All,

    I have the same requirement.
    I just want to skip the first Line of CSV file as it's a title of columns.

    How can I do that? Please provide the suggestion.
    Ravi_Thakkar
    Ahmedabad, Gujarat, India
    E Mail : ravi.thakkar@hotmail.com
  • ara3nara3n Member Posts: 9,256
    Is this a xmlport or dataport?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • jupjup Member Posts: 7
    I think that CSV -> dataport.. isn't it?

    If so, please try to first set the AutoSave property to "No" on the dataport DataItem, then create a global bool called i.e. glFirstLineSkipped and finally insert this code in the OnAfterImportRecord:
    IF NOT glFirstLineSkipped THEN
      glFirstLineSkipped := TRUE
    ELSE
      IF NOT yourTable.INSERT(TRUE) 
        THEN yourTable.MODIFY(TRUE);
    
    -- Jup --
  • ara3nara3n Member Posts: 9,256
    you can use xmlport for csv as well.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • jupjup Member Posts: 7
    Really? Never tried.. :)
    -- Jup --
  • Ravi_ThakkarRavi_Thakkar Member Posts: 392
    Thanks all for your help.
    My problem has been resoved by the procedure as JUP has suggested.

    Thanks again.
    Ravi_Thakkar
    Ahmedabad, Gujarat, India
    E Mail : ravi.thakkar@hotmail.com
Sign In or Register to comment.