loop through repeated section - InfoPath Dev
in

InfoPath Dev

loop through repeated section

Last post 01-16-2011 06:36 AM by Potemkine. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 01-16-2011 03:51 AM

    loop through repeated section

    Hi, i m trying to do loop through rows in repeating table, i managed to do that. if there is 3 lines i m able to to loop 3 times but the the value are not changing they keep the first line data

    here is my code:

    XPathNavigator navigator = MainDataSource.CreateNavigator();
    XPathNodeIterator rows = navigator.Select("/dfs:myFields/dfs:dataFields/tns:GetEmployeeDataResponse/tns:GetEmployeeDataResult/NewDataSet/EmplEdu", NamespaceManager);

    while (rows.MoveNext())
                       
                       {

    string EmplID = rows.Current.SelectSingleNode("/dfs:myFields/dfs:dataFields/tns:GetEmployeeDataResponse/tns:GetEmployeeDataResult/NewDataSet/EmplEdu/EMPLID", NamespaceManager).Value;

    string Education = rows.Current.SelectSingleNode("/dfs:myFields/dfs:dataFields/tns:GetEmployeeDataResponse/tns:GetEmployeeDataResult/NewDataSet/EmplEdu/Education", NamespaceManager).Value;
    string Desc = rows.Current.SelectSingleNode("/dfs:myFields/dfs:dataFields/tns:GetEmployeeDataResponse/tns:GetEmployeeDataResult/NewDataSet/EmplEdu/Descr", NamespaceManager).Value;
                            }

  • 01-16-2011 04:56 AM In reply to

    Re: loop through repeated section

    Two words: relative XPath.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 01-16-2011 05:04 AM In reply to

    Re: loop through repeated section

    I didnt understand

  • 01-16-2011 06:36 AM In reply to

    Re: loop through repeated section

    Hi, as Jimmy said you have to use relative Xpath:
    string EmplID = rows.Current.SelectSingleNode("EMPLID", NamespaceManager).Value;
    instead of
    string EmplID = rows.Current.SelectSingleNode("/dfs:myFields/dfs:dataFields/tns:GetEmployeeDataResponse/tns:GetEmployeeDataResult/NewDataSet/EmplEdu/EMPLID", NamespaceManager).Value;
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.