Command Reference CIB jsMerge

JavaScript Control Structures

Loops

Loops are executed as long as a set condition is true. The syntax for the while loop is:

while (condition) {
statement
}

See also the example from chapter Processing Data within Tables:

{#while(hasRec(“Persons”)) {

{#fref(“Persons.Salutation”))}

{#fref(“Persons.Name”))}

{#nextRec(“Persons”)}}}


As long as data records are present in the data supply "Persons", the fref() functions specified in the table will be executed and the nextRec() function steps to the next data record in the data supply.

The combination of while-loop and if-statement is shown in chapter mergeRec(tablealias) and in the example in chapter Coming from RTF: Comparison of Functions.