Afrter exporting XML shows only 1st item

vyankuvyanku Member Posts: 791
I create xml port for item table. containing fields No, Description.
When I export this xmlport it export only 1st item.
Why it is not exporting all items?
To export all items What I have to do?
Please suggest any soln..

Answers

  • kinekine Member Posts: 12,562
    You need to have correct XMLPort structure and you need to pass more records to the XMLPort and not just one (e.g. using SETRECFILTER or filtering to one No....)

    Structure must be something like:
    Items
      Item
        No
        Description
      Item
        No
        Description
      Item
        No
        Description
    ...
    
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • vyankuvyanku Member Posts: 791
    Do u mean that if there are 10 items in item tables then I have to design xml port as
    Item
    No
    Description
    Item
    No
    Description
    Item
    No
    Description
    ...
    10 times?

    If I add this 10 times then it shows me 1st value 10 times not all 10 items.

    If I write
    ifile.CREATE('C:\myxml.xml');
    ifile.CREATEOUTSTREAM(ostream);
    IF Item.FIND('-') THEN
    BEGIN
    REPEAT
    XMLPORT.EXPORT(50001,ostream);
    UNTIL Item.NEXT=0;
    END;
    ifile.CLOSE;
    MESSAGE('export complited');
    

    Then also it shows me 1st value 10 times but not all 10 items.
    What must be the problem?[/code]
  • kinekine Member Posts: 12,562
    vyanku wrote:
    Do u mean that if there are 10 items in item tables then I have to design xml port as
    Item
    No
    Description
    Item
    No
    Description
    Item
    No
    Description
    ...
    10 times?

    If I add this 10 times then it shows me 1st value 10 times not all 10 items.
    Of course NO! Just once. If set correctly, XMLPort will loop through all passed records and will repeat the tags for them.
    If I write
    ifile.CREATE('C:\myxml.xml');
    ifile.CREATEOUTSTREAM(ostream);
    IF Item.FIND('-') THEN
    BEGIN
    REPEAT
    XMLPORT.EXPORT(50001,ostream);
    UNTIL Item.NEXT=0;
    END;
    ifile.CLOSE;
    MESSAGE('export complited');
    

    Then also it shows me 1st value 10 times but not all 10 items.
    What must be the problem?[/code]

    Check the "MaxOccurs" property on the Table tag. There must be Unbound and not Once...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • vyankuvyanku Member Posts: 791
    Check the "MaxOccurs" property on the Table tag. There must be Unbound and not Once...

    Thanks Kine
    Its working fine. \:D/ :whistle:
  • DeviDevi Member Posts: 8
    Hai ,
    I am Devi .
    I am trying to export some data from purchase header table(38),but it is showing me only 1 item when i exported.

    This is the first time i am trying with xmlport.

    Can anyone guide/tell me how to do ?
    Pls it is of little urgent.


    thanks and Regards,
    Devi.
  • vyankuvyanku Member Posts: 791
    Check the "MaxOccurs" property on the Table tag. There must be Unbound and not Once...

    Try this u also..
Sign In or Register to comment.