How to iterate through a repeating table. - InfoPath Dev
in

InfoPath Dev

How to iterate through a repeating table.

Last post 05-06-2009 04:17 AM by madhuri. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 04-27-2009 01:15 PM

    How to iterate through a repeating table.

    I have a stored procedure to save individual rows of a repeating table as records in a database.  What I need to do is to write a web service so I can loop through the rows in a repeating table as I call the stored procedure for however many rows there are.

    I have used xsd.exe to create a class which I have included in my web service project and everything looks good, meaning that I can see all of my form fields in my project as expected, and I can handle everything else on the form that is not in the repeating table.  I can see all the fields in the repeating table.

    What I am having trouble with is, how do I loop through the rows in the repeating table?  I had thought it would be as easy as something like:

     foreach(int i in newForm.group1.Record)

    or

    for (i = 0; i <= newForm.group1.Record.GetLength(); i++)

    But I can't find what to use for the number of rows in the table.  Am I thinking about this completely wrong?  Should I be looking at the elements in the XML somehow instead?

    Any help would be appreciated, please tell me if you think I am going about this all wrong.

    A snippet from the template.xml for this form looks like (the "Record" is the repeating table):

     <my:group1>
         <my:txtContactName></my:txtContactName>
         <my:cboOffice></my:cboOffice>
         <my:txtAddress></my:txtAddress>
         <my:txtCity></my:txtCity>
         <my:txtZip></my:txtZip>
         <my:txtEmail></my:txtEmail>
         <my:txtPickUpParty></my:txtPickUpParty>
         <my:txtPickUpDate></my:txtPickUpDate>
         <my:txtOffice></my:txtOffice>
         <my:txtTelephone></my:txtTelephone>
         <my:txtExtension></my:txtExtension>
         <my:Record>
             <my:txtQuantity></my:txtQuantity>
             <my:txtPubID></my:txtPubID>
             <my:ddPubCat></my:ddPubCat>
             <my:ddPubTitle></my:ddPubTitle>
         </my:Record>
     </my:group1>

    Thanx

    Terry

  • 05-06-2009 04:17 AM In reply to

    Re: How to iterate through a repeating table.

    Hi

    Try using 'count'.

    Madhuri
    http://www.ggktech.com
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.