Options

XMLPort to import text file in RTC

Rob_HansenRob_Hansen Member Posts: 296
edited 2011-06-28 in NAV Three Tier
I created an XMLPort to import a comma-separated file. I defined a dummy root element of type text (since NAV said the root had to be text), then under that I created an indented element for the Table. Under that I defined (indented) each of the fields (actually, reading into variables to process manually). No matter what I try, when I run the dataport and select the input file, I just get the error that "The maximum length for a string value is 10." I tried defining a width (250) on all of my variable elements (even though this isn't a fixed-width import) but no luck. Does anyone know what would be causing this?

Comments

  • Options
    Rob_HansenRob_Hansen Member Posts: 296
    My issue here actually isn't related to a string length...well, it kind of is. My source text file has a header row, and I have code in place to skip that row (not process it), but the XML Port is processing that row over and over. Every time the code triggers for my Table element (where I handle the insert manually in the OnBeforeInsertRecord trigger), it's processing the same first line from the source CSV file. Do I have to do something to force the XML port to advance?
  • Options
    BeliasBelias Member Posts: 2,998
    well, not that i've done a lot of xmlports, but i usually do this to manage the import manually for "dataport xmls":
    -declare the table node as temporary
    -declare a (real) table variable for my table
    -add the fields i need under the temporary table node (saving a lot of variables declaration)
    -every time the temporary table is processed (i don't remember the trigger, but most likely onafterinsertrecord or something like that), flush the data in the real one

    as i don't see your code, i can't say what can be causing this endless(?) loop, but most likely some "next from hell"-like issue
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    Rob_HansenRob_Hansen Member Posts: 296
    Alright...this is resolved. It was in fact a code issue that I finally pinned down. :oops:
  • Options
    BeliasBelias Member Posts: 2,998
    i think you already tried to delete the first line from the text file and then import the file entirely and see that it works (or does not work)...
    anyway, this have never been happened to me (i've never had to do it, i mean)...maybe some code snippets can help, otherwise let's wait if there's someone who encountered the same problem :-k
    EDIT: ok, you already solved it...what was the problem?
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
Sign In or Register to comment.