How to iterate through all nodes in a repeating section - InfoPath Dev
in

InfoPath Dev

How to iterate through all nodes in a repeating section

Last post 04-24-2007 12:13 PM by Shiva. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 04-24-2007 06:19 AM

    • akjal
    • Not Ranked
    • Joined on 04-09-2007
    • Posts 4

    How to iterate through all nodes in a repeating section

    Hi

    i have a form created in Infopath 2003 and Visual studio 2005. I have a repeating section1 and it itself contains another repeating section and some non-repeating sections. I want to iterate through each of the repeating section and in turn inner repeating setions and take these values to fill some other forms.

    Is there any way to do like this? Is there any mechanism like for loop to go through this repeating section and if so what can be the condition for the loop?

     

    Any help will be grateful

     

    Thanks

  • 04-24-2007 12:13 PM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: How to iterate through all nodes in a repeating section

    Hi Akjal,

    You want to iterate the data repeat the section in that repeating section right. For this you need to use code like for or foreach as below:

    IXMLDOMNodeList outerRepeatingSectionNodeList = thisXDocument.DOM.selectNodes(“Xpath of your outer repeating section node”);

    foreach (IXMLDOMNode outerRepeatingSectionNode in outerRepeatingSectionNodeList)

    {

    IXMLDOMNodeList innerRepeatingSectionNodeList = outerRepeatingSectionNode.selectNodes(“Xpath of your inner repeating section node”);

    foreach(IXMLDOMNode innerRepeatingSectionNode in innerRepeatingSectionNodeList)

    {

    //Get the node1 value in innerRepeatingSection node

    string node1Value = innerRepeatingSectionNode.selectSingleNode(“Xpath of node1”).text;

    //Get the node2 value in innerRepeatingSection node

    string node1ealue = innerRepeatingSectionNode.selectSingleNode(“Xpath of node2”).text;

    //Do some code to append this node value to where do you want display the node

    } 

    }

    Note: Above code in C#.

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.