Row number s to table when xml import

KisuKisu Member Posts: 381
Heyas, how could I generate a row number for each data row I import from xml files

like:
thingy1.xml
thingy2.xml
thingy3.xml

would go to the table
rownumer | the data
1 | thingy1 data
2 | thingy2 data
3 | thingy2 data

I got the import code ready just need to put that row number adding code :-k
K.S.

Comments

  • NagiNagi Member Posts: 151
    Hello Kisu,

    Couldn't you just use a counter variable type integer and then increment it in a trigger that fires once per file that is read?

    If you need to assign the counter an initial value based on what is already in the table, then do a FINDLAST on a record variable pointing to your table to find the last row number.
  • kinekine Member Posts: 12,562
    you mean to read the number form the file name?

    You have two ways:

    1) scan the string from beginning until you find character >='0' and <='9', than continue in scan, until you find another character. Text between these two point take into separate variable and using evaluate transform it into number.

    2) delete all characters <'0' and >'9' from the string (you can use the DELCHR) and rest transform into number...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • NagiNagi Member Posts: 151
    Just adding to what Kine said above; here's a simple way to only keep numbers in any given string.
    RowNumber := DELCHR(XmlFileName,'=',DELCHR(XmlFileName,'=','0123456789'));
    
  • KisuKisu Member Posts: 381
    Ah yeh, made variable and increment it. works now ^^

    Thanks for replies.
    K.S.
Sign In or Register to comment.