XMLport import for comma delimited text file

RoelofRoelof Member Posts: 377
edited 2011-02-03 in NAV Three Tier
Hi,
Is there a way to import a comma delimited text file using a XMLPort. I need to find a way to import file within RTC. How would an XMLport look like?

Thanks.
Roelof de Jonghttp://www.wye.com

Comments

  • kinekine Member Posts: 12,562
    it will look like dataport, just the table will be as a root element of type table and the fields will be like elements of type field under the table element. Just study the documentation, you will find what you need. ;-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • RoelofRoelof Member Posts: 377
    What would be the structure of the defined fields (Node Name, Node Type, Source Type, Data Source
    Roelof de Jonghttp://www.wye.com
  • kinekine Member Posts: 12,562
    Name, does not matter, type element, source type table or field, data source is the table or the field...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • RoelofRoelof Member Posts: 377
    The other question I have is: In the codeunit I need to create a XMLPort DataType, instead of 'XMLPort.import(ID,Instream), since I want to transfer/set paramaters before starting the XMLPort.
    This is my code, but I'm sure I miss something.
    Note: the xml import is basically importing gen jnl line info in Deposits.

    GLSetup.GET;
    GLSetup.TESTFIELD("Cash Receipts File Name");
    vXMLPort.SetFileName(GLSetup."Cash Receipts File Name");
    vXMLPort.SetDeposit(DepositHeader);
    ImportFile.OPEN(GLSetup."Cash Receipts File Name");
    ImportFile.CREATEINSTREAM(vInStream);
    vXMLPort.SETSOURCE(vInStream);
    vXMLPort.IMPORT;
    IF NOT ISSERVICETIER then
    ImportFile.CLOSE;

    My question is:
    - how to set the filename
    - is the instream correct
    Basically is the whole structure correct?
    Roelof de Jonghttp://www.wye.com
Sign In or Register to comment.