Exporting XML with some filters

snyktpsnyktp Member Posts: 75
edited 2010-02-18 in Navision Attain
Hello,

I want to export the records . A Xml file must be created for every record. But it doesnt work. I created a function on the XML file(GelAllFilters). Firs I call this function after that I export xml file.. Do you have any suggestion about this ?
Thank you

XLabel.RESET;
XLabel.SETRANGE(Resend,TRUE);
IF XLabel.FINDSET THEN
REPEAT
Xfile.CREATE(Filename);
Xfile.CREATEOUTSTREAM(FXOutStream);
XMLSale.GetAllFilters(XLabel."Lot No.",XLabel."Vendor No.",XLabel."Sales Order No.");
XMLSale.EXPORT(); //XMLPORT.EXPORT(60036,XOutStream,FlorecomLabel);
Xfile.CLOSE;
Mail.NewMessage(mailadd,'',
'' + ' ' + 'Subject Info' + ' ' + FORMAT(FileNo),
'',Filename,FALSE);
UNTIL.......

Answers

  • ara3nara3n Member Posts: 9,256
    what code have you put in GetAllFilters function in the xmlport?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • snyktpsnyktp Member Posts: 75
    Hello

    I sent some parameters to filter.. Like this;

    LotNo := CLotNo;
    VendorNo := CVendorNo;
    SalesOrder := CSalesOrder;

    After that I give some filter with these parameters on the table as you see below
    X Label - Export::OnPreXMLItem()
    XLabel.SETRANGE("Lot No.",LotNo);
    XLabel.SETRANGE("Vendor No.",VendorNo);
    XLabel.SETRANGE("Sales Order No.",SalesOrder);


    Thank you
  • ara3nara3n Member Posts: 9,256
    Here is the code I used the following code.

    you were missing

    XMLSale.SETDESTINATION( FXOutStream);
    XLabel.RESET;
    XLabel.SETRANGE(Resend,TRUE);
    IF XLabel.FINDSET then REPEAT
      Xfile.CREATE(Filename);
      Xfile.CREATEOUTSTREAM(FXOutStream);
      XMLSale.GetAllFilters(XLabel."Lot No.",XLabel."Vendor No.",XLabel."Sales Order No.");
      XMLSale.SETDESTINATION( FXOutStream);
      XMLSale.EXPORT(); 
      Xfile.CLOSE; 
      Mail.NewMessage(mailadd,'','' + ' ' + 'Subject Info' + ' ' + FORMAT(FileNo),'',Filename,FALSE);
    until XLabel.next = 0;
    

    I'm curios by this line

    X Label - Export::OnPreXMLItem()

    in xml you cannot have spaces in the xmltags. Your has a space in tag.

    Also XLabel is a global variable? or is it declared as data source?

    Btw it works for me.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • snyktpsnyktp Member Posts: 75
    Hello,

    First thank you for your answers

    TagName DataSource SourceType TagType
    PutRequestDetails <X Label Message>(X Label Message) Table Element


    GetAllFilters(CLotNo : Code[20];CVendorNo : Code[20];CSalesOrder : Code[20])
    LotNo(global variable) := CLotNo;
    VendorNo(global variable) := CVendorNo;
    SalesOrder (global variable) := CSalesOrder;
    PutRequestDetails - Export::OnPreXMLItem()
    "X Label Message".SETRANGE("Lot No.",LotNo);
    "X Label Message".SETRANGE("Vendor No.",VendorNo);
    "X Label Message".SETRANGE("Sales Order No.",SalesOrder);


    I think they are clear...
    I added destination but it didnt work :(

    Thank you
  • ara3nara3n Member Posts: 9,256
    I've attached an example object that exports sales orders. In this case I'm filtering sales order no.

    Take a look at the example and compare to your objects. The fob contains two objects in 50005 report and 50005 xmlport.
    \
    http://sites.google.com/site/ara3nfiles ... edirects=0
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • snyktpsnyktp Member Posts: 75
    Thank you thank you...
    This is the problem ; I used CLEARAL on preXMLProt . I didnt notice this
    I deleted it.It works correctly..
    Thank you for your help
  • ara3nara3n Member Posts: 9,256
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • alwaysgunaalwaysguna Member Posts: 45
    Dear All,

    Is there any way to apply table filter for Multiple dataitem (table) as we do in report/dataport ?

    Example :

    I have one XMLport with 3 dataitem with no links

    Table1
    Table2
    Table3

    I want to apply filters for each of this tables when calling a XMLport.
    Guna
  • ara3nara3n Member Posts: 9,256
    create functions in the xmlport and pass the table1, table 2, to the xmlport

    in those function copy the filters to the local table 1, table 3 and table 3.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • alwaysgunaalwaysguna Member Posts: 45
    Hi Rashed ,

    Thanks for the solution, worked well for me.
    Guna
Sign In or Register to comment.