Repeating (looping)

@index

  • no parameters

  • returns a whole number

@index — no parameters or parentheses necessary — returns the current iteration number if this function is called from within a “loop”, i.e. when the software cycles between the elements of a list. This is for example the case when repeating a row in a table, or when going through repeating clauses. @index will return zero if used outside a loop.

For example, if #customer^name is a repeating list that contains the names “John Smith”, “Jane Doe” and “Marie Thompson”, then the following output would be produced in a table with a repeating-row . The @index starts at 1, and is then incremented with each additional row, until the end of the loop.

Note that (unlike most programming languages) the returned number is one-based, i.e. the first iteration in a loop will be one (not zero).

To get the row-index in the context of a Q&A column condition, use @row-index instead.

Last updated