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
  1. Create an event, and add a Loop action to it.

  2. (Optional) Type a name in the Name field to help identify the action.

  3. Click the Add Rule button and select an expression type.

    This is the statement that must evaluate to true for the event to continue.

  4. Click OK to close the Add Rule dialog box.

  5. From the Event editor, click the Add Tests button.

  6. 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.

    To
    Do this
    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
    1. Right-click the selected data element and choose Compare with Constant.

    2. In the Constant dialog box, enter the value for the constant, then choose OK.

      Do not use the following characters in your constants: +, -, \, /, (, ), or '. (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.)

  7. Click OK to close the Add Tests dialog box.

  8. 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."

    Note 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.

  9. Click OK to close the Event editor.

Related Topics
Bullet Adding Events, Overview
Bullet Adding Events to Controls
Bullet Adding Actions to Events
Bullet Action Descriptions: Loop
  Attachmate