XML Port

aka_USAPAaka_USAPA Member Posts: 62
I have created an XML Port to export Purchase Header & Purchase Line data. I need to run it on the Purchase Order form. Does anyone know how I can filter the XMLPort to run on the current Purhase Order No. (record) I'm in? I would appreciate your help. Thanks.

Comments

  • bbrownbbrown Member Posts: 3,268
    Use SETTABLEVIEW in the same way you would filter a report. Set filters on a record variable and then pass it to XMLPORT using xmlport.SETTABLEVIEW.

    EXAMPLE:

    POHeader.SETRANGE("Document Type",
    POHeader."Document Type"::Order);
    POHeader.SETRANGE("No.", '000150');
    xml1.SETTABLEVIEW(POHeader);
    There are no bugs - only undocumented features.
  • aka_USAPAaka_USAPA Member Posts: 62
    With this method, how do I specify the xml fiel name?

    xml1.export runs

    How do I control the xml file name and destination?
  • atarisataris Member Posts: 109
    If you want to specify the file name and export you could do the following:


    TestFile.CREATE('C:\XML_CUSTOMER.XML'); //Creates file
    TestFile.CREATEOUTSTREAM(TestStream); //Creates stream

    //Export

    XMLPORT.EXPORT(90000,TestStream);
    TestFile.CLOSE; //Close file
    MESSAGE('DONE'); //Message once completed

    90000 is the port number of the XML Object you are using. TestStream is a variable of type OutStream used to Stream out the data.

    Hope this helps..
  • aka_USAPAaka_USAPA Member Posts: 62
    Yes that helps but how do I filter the xmlport with the current record from the purchase order screen, and still be able to control the output xml file. It looks like if I define an xml variable, I can use the settableview property but after that, I don't know how to specify the xml file output and path.

    Also, does anyone know what the SETSOURCE and SETDESTINATION methods are for? There is no documentation for it in Help.
  • aka_USAPAaka_USAPA Member Posts: 62
    Hi guys!

    Just in case this will be helpful to anybody, here is how I got it to work:

    1) Define an xmlport variable
    2) Set the table view to the record I want using the SETTABLEVIEW method
    3) Set the file name & destination using the SETDESTINATION method (this is the Outstream)
    4) Run the xmlport using xml1.EXPORT

    It worked like a charm. Thanks for all your help.
Sign In or Register to comment.