Incrementing repeating table field values

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")
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *