Xmlport In Navision 4.0

AngeloAngelo Member Posts: 180
I think documentation of xmlport in Navision is not complete (like w1w1adg.pdf). Anyone have another documentation for the object? :cry:

I want to export to XML via XMLport. for example, Exporting All Sales Header and its Line. But when I tried it, There is only make 1 document no. of sales header in my xml file. Any one can help me how to export all sales header (all document No.)? [-o<

In XMLport is not like Dataport and Report that before printing or exporting, we can filter it first. How About XMLport?can we do that? :-k

Please advise.....


regards,
Angelo

Comments

  • kinekine Member Posts: 12,562
    Look into existing xmlports to see, how are designed. When you are running the xmlport, you can past record on which is runned, or you can setview for the table... but I have no experiences now with XML ports... it is only theoreticaly based...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • AngeloAngelo Member Posts: 180
    Please more specific...... [-o<
    We know that XML port is very new in Navision but I disappoint because documentation is very limited.
  • kinekine Member Posts: 12,562
    For me it is new too... 8)

    example:

    in XMLPort 8002 is structure:
    Item - Table - T27
      No. - Field- No.
      Description - Field - Description
    .
    .
    .
    and one XML-Event Inventory Status
    

    This XML port is called in this way:
        RecRef.SETTABLE(Item);
        Item.SETRECFILTER;
        ItemXML.SETTABLEVIEW(Item);
        ItemXML."Inventory Status";
    

    But I don't know, what it is the XML-Event and where is the OutStream into which is the XML sent...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • fbfb Member Posts: 246
    ...how to export all sales header...
    An xml file must have a single 'root element', so if you want to export multiple records, your first element must be a text element that names the collection. Look at the design of XMLPort 10 IC G/L Account Import/Export. The first element is simply the text tag <GLAccounts>. Then, indented 1 level, it lists the table that the (multiple) records will come from...

    So, to export multiple Sales Headers/Sales Lines, you might use the following indentation scheme:
    SalesDocuments -- Text
    .SalesDocument -- Table(Sales Header)
    ..SalesHeader -- Text
    ...<Sales Header Fields Here>...
    ..SalesLines -- Text
    ...SalesLine -- Table(Sales Line)
    ....<Sales Line Fields Here>...
    
    Then, to run the XMLPort, and possibly to apply filters to the records to export, look at the example in Form 605 - IC Chart of Accounts - procedure 'ExportToXML'.

    Your export code might look something like this:
    // create the output file, and get its outstream...
    MyOutputFile.CREATE(MyOutputFileName);
    MyOutputFile.CREATEOUTSTREAM(MyOutputStream);
    
    // set appropriate filters...
    MySalesHeader.SETRANGE("Document Type",...);
    MySalesHeader.SETRANGE("No.",...);
    MySalesDocsXMLPort.SETTABLEVIEW(MySalesHeader);
    
    // set the xml port destination, and run the xml port...
    MySalesDocsXMLPort.SETDESTINATION(MyOutputStream);
    MySalesDocsXMLPort.EXPORT;
    
    // all done...
    MyOutputFile.CLOSE;
    
  • AngeloAngelo Member Posts: 180
    Thank you of you all.... :lol:

    SETDESTINATION, SETSOURCE,SETRESPONSE,GETRESPONS function is not found in help. Do anyone know about the using of the functions?

    if eveybody have documentation about XML, can share it in this forum?



    regards,

    Martheus
Sign In or Register to comment.