Options

Use XMLPort to import flat file?

ccbryan63ccbryan63 Member Posts: 115
edited 2012-02-22 in NAV Three Tier
What I've seen indicates that XMLports can be configured to work like dataports. I assume that you set the Format property to variable. But I'm getting

"The XML Parser return the following fatal error: Incorrect documnet syntax. Line Number = 1 Column No. = 1"

Here's what my text file looks like:

"PAYROLL","10000","11",11/30/2010,"Payment","Regular.....
"PAYROLL","20000","139",11/30/2010,"Payment","Regular....
"PAYROLL","30000","14",11/30/2010,"Payment","Regular....

My XMLport Designer looks like this:
Node Name                       Node Type     Source Type         Data Source
------------                    -----------   -----------         -----------
Root                            Element       Text                <Root>
   Payroll Journal Line         Element       Table               <Payroll Journal Line>(Payroll Jouirnal Line)
      JournalTemplateName       Element       Field               <Payroll Journal Line>:: Journal template Name
      LineNo                    Element       Field               <Payroll Journal Line>:: Line No.
......

I have set the properties to
Direction = Import
Format = Variable Text
Field delimiter = <:>
Field Separator = <,>

Is there a brief answer to "What am I doing wrong?"

Thanks...

Comments

  • Options
    SavatageSavatage Member Posts: 7,142
    Field delimiter = <:>

    looks like quotes to me "

    why isn't the date field surrounded by "'s
  • Options
    Alex_ChowAlex_Chow Member Posts: 5,063
    From what I understand, the XMLport will only act like a dataport if you run it in the RTC environment. In another words, no classic client or NAS.
  • Options
    ccbryan63ccbryan63 Member Posts: 115
    D'oh, that was a typo in my question. Field Delimiter is (and has been) <">.

    I'm kind of expecting an error on the date field actually, but not on Line 1 column 1??

    I am intending this XMLport to run on the RTC, but it has to be designed on the Classic side, no?

    I have also seen it bandied about that dataports can be run on the RTC if you stick them in a process-only report (dataport.runmodal(50000)) but I get "RUNMODAL" (and RUN for that matter) are obsolete".
  • Options
    Alex_ChowAlex_Chow Member Posts: 5,063
    Nope, not true. You cannot run dataports in RTC. Only XMLports.
  • Options
    ccbryan63ccbryan63 Member Posts: 115
    OK, I more or less got it solved. The main problem was apparently that I was trying to run the XMLPort to import a flat file from Classic instead of from the RTC.

    However, I still need to do some manipulation of the data, evaluating incoming values. And I am still getting a compile error in the XMLport whenever i try to refer to the node name (DocumentType) or the field name ("Document Type"). Either way, I get a 'variable not recognized error', even in the trigger named DocumentType. What am I missing??
  • Options
    aquariousaquarious Member Posts: 32
    Hi,

    I have same error as above.

    I m trying to import Flat File with XMLPort.

    I wrote a Codeunit with SingleInstance and call the XMLPort Import. I have setup NAS to run the Codeunit from Codeunit 1.

    IF i link the Codeunit into RTC and click on the Codeunit from RTC, It seem the flat file successfull import via XMLport Import but when i switch it to NAS I have this error

    "The XML Parser return the following fatal error: Incorrect documnet syntax. Line Number = 1 Column No. = 1"

    Have anyone have this issue with XMLPort Import flat file via NAS?

    Thank you
  • Options
    JosephGressJosephGress Member Posts: 36
    I don't think you will be able to run an XMLPORT with the Format property set to Variable or Fixed Text from NAS. I tried something similar a couple months ago and found that NAS does not recognize the Format property. It treats all XMLPORTS as Format=XML.
    Joseph Gress
  • Options
    aquariousaquarious Member Posts: 32
    Hi JosephGress,

    Finally i just used report to import text file and run nas to import. I m suspecting the same that the NAS ignored the Text file and expecting XML format .

    Thanks for feedback
Sign In or Register to comment.