Filling a repeating table from xml doc at once - InfoPath Dev
in

InfoPath Dev

Filling a repeating table from xml doc at once

Last post 12-31-2005 12:38 PM by mar. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 12-29-2005 03:00 PM

    • mar
    • Top 500 Contributor
    • Joined on 09-04-2005
    • Poland
    • Posts 37

    Filling a repeating table from xml doc at once

    Im using xmltextreader 'doc' to get the file. File looks like this:
    [...]
    <node>
    <field1>x1</field1>
    <field2>y1</field2>
    </node>
    <node>
    <field1>x2</field1>
    <field2>y2</field2>
    </node>
    [...]

    Then it goes like that:
    (table and row is pointed ok)
    row=row.clonenode(true);
    while(doc.read())
    {
    if(doc.name==xmlnodetype.element)
    {
    if(doc.name=="my:field1")
    { row.selectsinglenode("xxx").text=doc.readelementstring; doc.read(); }
    if(doc.name=="my:field2")
    { row.selectsinglenode("yyy").text=doc.readelementstring; doc.read(); }
    table.appenchild(row);
    }
    }


    And i always get only last node's fields in my table...When i click button again it adds a new row, with last node's data of course...What is wrong?
  • 12-30-2005 12:06 AM In reply to

    • mar
    • Top 500 Contributor
    • Joined on 09-04-2005
    • Poland
    • Posts 37

    Re: Filling a repeating table from xml doc at once

    Please help... How to add multiple rows to repeating table by one click?
  • 12-30-2005 04:18 AM In reply to

    • mar
    • Top 500 Contributor
    • Joined on 09-04-2005
    • Poland
    • Posts 37

    Re: Filling a repeating table from xml doc at once

    Well, i moved row=row.clonenode(true); right before table.appenchild(row) and it works...almost...I have 2 copies of last node, and any new clik, fills first row in table(erasing it's content) and rest of nodes are append on bottom of table correctly with a new rows...
  • 12-30-2005 05:28 AM In reply to

    • mar
    • Top 500 Contributor
    • Joined on 09-04-2005
    • Poland
    • Posts 37

    Re: Filling a repeating table from xml doc at once

    This first row is killing me...How force 'table.appendchild(row)' to inserting right after last inserted row??
  • 12-31-2005 10:34 AM In reply to

    Re: Filling a repeating table from xml doc at once

    What language are you using? That does not look familiar.

    Using JScript, this should be able to be accomplished like this:

    var parentGroup = XDocument.DOM.selectNodes( "//childNodes" );
    var oneSampleNode = parentGroup.nextNode();

    parentGroup.appendChild( oneSampleNode.cloneNode( false ) );

    ---------------
    Matt Faus
    InfoPath Dev Texas
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 12-31-2005 12:38 PM In reply to

    • mar
    • Top 500 Contributor
    • Joined on 09-04-2005
    • Poland
    • Posts 37

    Re: Filling a repeating table from xml doc at once

    Thanks for answer, im using c#. I removed this problem by adding last() function to ixmldomnode, and im adding a new row always when im going do append a row(without this it erases last row).

    ps.Happy New Year everybody :-)
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.