Accessing rows in repeating group for browser enabled forms
There are not so many differences in versions of XPath between regular forms and web enabled ones. But inability to reference rows in web enabled forms by the index is one of the most annoying. Here are several XPath formulas useful when interacting with repeating tables:
1. The current row index expression:
count(preceding-sibling::*[local-name() = "MyRepeatingGroup"])
As you can see that formula successfully substitutes the position() function not available in web forms.
2. Accesing value of the previous row:
preceding-sibling::my:MyRepeatingGroup[count(preceding-sibling::my:MyRepeatingGroup) = count(current()/preceding-sibling::my:MyRepeatingGroup) - 1]/my:FieldToAccess
3. Implementation of the last() function:
my:MyRepeatingGroup[count(following-sibling::*[local-name() = "MyRepeatingGroup"]) = 0]/my:FieldToAccess
4. Count all rows that have duplicates:
count(my:MyRepeatingGroup[following-sibling::*/my:FieldToAccess = my:FieldToAccess])
5. The other technique demonstrates idea of how to wright into repeating group by providing index of the row and a value:
Form to try.
Happy codeless programming!