This will help you loop through a Repeating Table in InfoPath. group2 is the name of my Repeating Table. sFunction is a function I use to check if a value has been updated in a SharePoint Library or List. If the value returned from the function does not match what I have in my drop down list, I update it with the function value.
Dim rootX As XPathNavigator = MainDataSource.CreateNavigator
Dim rowX As XPathNodeIterator = rootX.Select(“/my:myFields/my:group1/my:group2”, NamespaceManager)
While rowX.MoveNext
Dim sStatus As String = rowX.Current.SelectSingleNode(“my:field4”, NamespaceManager).Value
Dim sI As String = rowX.Current.SelectSingleNode(“my:field2”, NamespaceManager).Value
Dim sS As String = sFunction(sI)
If sStatus <> sS Then
rowX.Current.SelectSingleNode(“my:field4”, NamespaceManager).SetValue(sS)
End If
End While