Go to Contents
Previous
Page
Next
Page
Contents > Script steps reference (alphabetical list) > Control script steps > Exit Loop If script step

Exit Loop If script step
Format

Exit Loop If [<Boolean calculation>]
Options
Click Specify to define the Boolean calculation. In the Specify Calculation dialog box, type the calculation you want evaluated, or use the field list (on the left) and the functions list (on the right) with the mathematical and text operators to build the calculation.
Web compatibility
This script step is web-compatible.
Description
Exits a Loop if the specified calculation is True (not zero). The script execution continues with the first script step after the Exit Loop step.
If the calculation if False (zero), the loop is not exited and the script continues with the script step that follows the Loop script step.
Example
This example calculates a bonus for the top 10 sales agents based on their sales. The script finds all records and sorts by a field called "Sales" (descending) to arrange the agents by sales performance. The script starts at the first record and sets the loop counter variable to 1 (in this example the loop counter field use is a number field with global storage enabled -- this is the Count field in the example below). Then, the script calculates the bonus as one quarter of the agent's salary. The script then goes to the next record and exits the loop if the counter reaches 10. The loop counter increments by 1 and the loop repeats.

Show All Records
Sort Records[Restore; No dialog]
Set Field [Table1::Count; 1]
Loop
   Set Field [Table1::Bonus; Table1::Salary * .25]
   Go to Record/Request/Page[Next]
   Exit Loop If [Table1::Count = 10]
   Set Field [Table1::Count; Table1::Count + 1]
End Loop
Related topics
Defining calculation fields
If function
If structure example
Loop structure example
Script steps reference (alphabetical list)
Script step categories
About formulas

Contents > Script steps reference (alphabetical list) > Control script steps > Exit Loop If script step
Previous
Page
Next
Page