Only the first row is getting retrieved in Repeating table - InfoPath Dev
in

InfoPath Dev

Only the first row is getting retrieved in Repeating table

Last post 03-12-2012 08:00 AM by Hilary Stoupa. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 03-09-2012 09:19 PM

    Only the first row is getting retrieved in Repeating table

     

    Hi,

    I am using InfoPath browser enabled form.

    I have a repeating table,which has insert row enabled.

    I am using the XMLFormView.

    I am using the below code to retrieve the values:

    [CODE]

    string wcGeneralToDo = string.Empty;

    XPathNodeIterator iter = mainDataSource.Select("/my:myFields/my:RPSection/my:RPTable", nameSpaceManager);
                    
                   
     wcGeneralToDo += "Country State File# BureauName Ann.Rating Date";
                    while (iter.MoveNext())
                    {
                                         
                      
                        wcGeneralToDo += iter.Current.SelectSingleNode("/my:myFields/my:RPSection/my:RPTable/my:ApplicableCountry", nameSpaceManager).Value + " ";

                        wcGeneralToDo += iter.Current.SelectSingleNode("/my:myFields/my:RPSection/my:RPTable/my:ApplicableState", nameSpaceManager).Value + " ";

                        wcGeneralToDo += iter.Current.SelectSingleNode
    ("/my:myFields/my:RPSection/my:RPTable/my:IDNumber  ", nameSpaceManager).Value + " ";

                        wcGeneralToDo += iter.Current.SelectSingleNode("/my:myFields/my:RPSection/my:RPTable/my:RatingBureau", nameSpaceManager).Value + " ";

                        wcGeneralToDo += iter.Current.SelectSingleNode("/my:myFields/my:RPSection/my:RPTable/my:AnnRatingDate", nameSpaceManager).Value + " ";
                      
                   

    [/CODE]

    I have added 2 rows in repeating table, and when the code above is executed, i am getting "iter" count as 2, however after the while loop is executed twice, the first data is shown twice in wcGeneralToDo.

    How to add both the rows? Any help on this.

    Thank you

  • 03-12-2012 08:00 AM In reply to

    Re: Only the first row is getting retrieved in Repeating table

    Hi - you need to be using relative XPaths.

    Your node iterator used this XPath: /my:myFields/my:RPSection/my:RPTable

    So your other selections should be like this: wcGeneralToDo += iter.Current.SelectSingleNode("my:ApplicableCountry", nameSpaceManager).Value + " ";

    Hilary Stoupa

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