The JavaScript API contains functions to iterate, or loop over, all the rows in a
Table.
Using the JavaScript API we can get a Row Iterator for any Table in the
Form, for example, var rowIterator = table.myTable.getRows();
. Calling next()
on the row iterator updates the Table's Current Row to point to the next row in the Table. Any interaction with a Table's Columns, for example tables.myTable.myColumn.value;
, addresses that row in the Table.
For example:
// Get the Row Iterator for myTable
var rows = tables.myTable.getRows();
// Iterate over the all the Rows in myTable.
while (rows.next()) {
// Set myColumn's value to 3.
tables.myTable.myColumn.value = 3;
}
When the Row Iterator is instructed to move on from the last row in the Table, the next()
function returns false
and the Table's Current Row is set back to the value is was at prior to the Row Iterator iterating over the Table.