Adding Loops to Events
Use the Loop action to add a conditional expression to an event that will run additional actions in the event as long as the condition evaluates as true. The Loop action is the same as a Decision Branch action, except that once the action has completed, it will re-evaluate the condition, and execute as long as the branch condition remains true. In essence, a loop is a repeating decision branch.
|To add a loop to an event
- Create an event, and add a Loop action to it.
- (Optional) Type a name in the Name field to help identify the action.
- Click the Add Rule button and select an expression type.
This is the statement that must evaluate to true for the event to continue.
- Click OK to close the Add Rule dialog box.
- From the Event editor, click the Add Tests button.
- From the Add Tests dialog box, build a test that compares two operands to evaluate a condition.
The operands can be fields on a host screen, values of controls on a form, constants you define basically, any of the data elements available to your application at that time.
|Convert both operands to numbers before comparing them
- Under Type, click the value field, and then select Numeric.
|Change the operator to a different value
- Under Operator, click the value field, and select the operator you want from the drop-down list. (Default: Equals.)
|Compare an operand to a constant you define
- Right-click the selected data element and choose Compare with Constant.
- In the Constant dialog box, enter the value for the constant, then choose OK.
Do not use the following characters in your constants:
'. (The expression evaluator treats these characters in a particular way; therefore, they cannot be used as part of constant values in a test condition of a decision branch step.)
- Click OK to close the Add Tests dialog box.
- From the Event editor, add one or more sub-actions to the Loop action.
The sub-actions are like any other action, except that they will repeatedly occur as long as the Loop expression evaluates to "true."
||When the execution thread of an event reaches a Display Form action, the event will finish. This is true even when the Display Form action is in the loop. For this reason, it is not good practice to add a Display Form action at the end of a Loop because the loop will only run once, even if the condition evaluates to "true" again.
- Click OK to close the Event editor.