A Repeat is a collection of Form Fields that can contain more than one set of data. For example, a Repeat can be used to collect the names and addresses of a group of people. Each row within a Repeat holds a single ‘data set’.
Working with a Repeat as an ‘object’
The following Script returns the Repeat collection as an ‘object’ that can be dealt with using other Script and functions:
For example, repeat(‘rptname’).length will be equal to the number of rows in the Repeat called ‘rptname’.
Finding how many rows a Repeat has
However, you can more easily get the number of rows in a Repeat using the following system function:
Working with a ‘Repeat within a Repeat’
If you need to work with a Repeat inside a particular Repeat, you can use this function to select the Repeat as an object:
The ‘xyzrpt’ bit refers to a Repeat you have already referenced (for example xyzrpt = this.closest(‘.repeat’). The 'repeatname' is the Repeat within that Repeat that you want to work with as an object.
You would use this if you wanted to find only the Repeats within a particular parent Repeat row, and not all of the rows of the parent Repeat.