Pass record to xmlPort for Export

justincalejustincale Member Posts: 6
Hi,

I am trying to pass a record to an xmlPort for export. For some reason, no matter what i try, the xmlport only ever exports the first record in the table and not the record i'm trying to pass in. I have used the code i found in the manual which is:


OUTFILE.CREATE('C:\SR' + FORMAT("Document Sequence") +'.xml');
OUTFILE.CREATEOUTSTREAM(mOutStream);

XMLPORT.EXPORT(16003950, mOutStream, Rec);

Even tho i am passing Rec, the xmlPort still exports only the first record in the table.

Has anybody else had this problem or does someone know a solution??

thanks in advance.

Justin

Comments

  • kinekine Member Posts: 12,562
    You are not passing record, you are passing view (filters). You need to apply filter which will select exactly the one record. Try to use SETRECFILTER before passing the variable. And use another variable than REC for that...
    ...
      Rec2.COPY(Rec);
      Rec2.SETRECFILTER;
    ...
    
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • johnny_martins00johnny_martins00 Member Posts: 39
    Hi,

    justincale did you managed to get it?

    Im facing the same problem, only that im calling the XmlPort thru a codeunit, in order to send it to BN...

    I've allready tried with SETRECFILTER AND SETTABLEVIEW, but it always sends the first record of the table...
    IF NOT ISSERVICETIER THEN BEGIN
     NotificationSetup.GET;
      IF NOT NotificationSetup."Send Notifications" THEN
        EXIT;
        GlEntry.SETRECFILTER;
      PaymentXML.SETTABLEVIEW(GlEntry);
        PaymentXML.PaymentDone;
    
    

    How did you solved it?

    Thanks
    Regards
    JM
  • kinekine Member Posts: 12,562
    Depends on what is PaymentDone in the XMLPort...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • johnny_martins00johnny_martins00 Member Posts: 39
    Hi Kine,

    PaymentDone it's the Xmlport event, that i raise.

    Thanks,
    Regards
    JM

    EDIT - SETTABLEVIEW worked out for me :) My problem was that i was calling my xmlport in the OnInsert trigger, where the records weren't in tha DB yet... Calling the XmlPort after the insert event worked out for me :)

    Regards
    JM
Sign In or Register to comment.