Passing Parameters from Codeunit to XMLDataport

ChessExpertChessExpert Member Posts: 103
Hello Nav experts.

I wrote an XMLPort and created a codeunit to execute the XMLPort. And it is working fine. I just need to pass some information from the code unit to the XMLPort so that it can be added on the processing and be written to a table (General Journal Line).

In my code unit, I have created a global XMLPort variable like
Variable: xml_XMLImport
Type : XMLPort
SubType: JournalEntries


Part of my code looks like this.

TestFile.OPEN('NAV.xml')
TestFile.CREATEINSTREAM(TestStream);
xml_XMLImport.SETSOURCE(TestStream);
// xml_XMLImport.SETTABLEVIEW(Rec); // I can set this from codeunit, don't know how to retrieve it from the XMLPort
// HERE: I need to set some global variables in the XMLPort
xml_XMLImport.IMPORT();
TestFile.CLOSE;


Can you please let me know how to pass text or record variables to the XMLPort.

Thank you in advance.

Answers

  • ara3nara3n Member Posts: 9,256
    Modify the xmlport. Create a new function in the xmlport called Passparameters.

    In your code called the function

    TestFile.CREATEINSTREAM(TestStream);
    xml_XMLImport.SETSOURCE(TestStream);
    xml_XMLImport.PassParameters(yourValue);
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • ChessExpertChessExpert Member Posts: 103
    Thank you once again Rashed. It worked perfectly fine as per you advice. :D

    Regards,
    ChessExpert.
  • ara3nara3n Member Posts: 9,256
    You are welcome.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.