How to increment a field for new rows added into a repeating table in InfoPath
It is really helpful to users to incrementally auto-populate newly added rows. In InfoPath, XPath is used to specify calculated values. To count the number of rows that exist, we can use the following expression:
count(../preceding-sibling::*)
This returns the 0 based count of existing rows. First row would be zero. To get a one-based count, simply use:
count(../preceding-sibling::*)+1
What if you want to have letters that increase? One way is to use the XPath translate(0 function such as:
translate(count(../preceding-sibling::*), "012345", "ABCDEF")