Feedback

  • Contents
 

Loop

Use the Loop action in a task or state to make your process repeat a series of actions before it goes on to the next action in your design. The loop can execute any action available in states: note that the available state actions list differs slightly from the list of actions available in tasks.

You can create three kinds of loop actions:

  • Loop through items a collection: This applies the actions inside the loop to each item of a collection of variables, then exits the loop.

  • Loop until a fixed count is reached: This applies the actions inside the loop for a number of times that you specify. For example, if you specify 10, then the loop will run 10 times before moving forward to the next action in your process design.

  • Loop while a condition is true: This applies the actions inside the loop as long as a certain condition is true, such as an integer value being greater than zero. You use the Calculation Editor dialog box to construct the condition.

Warning: Do not insert or remove items from a collection while inside a loop traversing the collection. Doing so can corrupt your data or cause the process to crash.

Note: There are two ways to loop while a condition is true. First, you can check the condition before going through the loop. If you check before going through the loop, then if the condition is false, the process will not go through the loop. Second, you can check the condition after going through the loop. In this case, the process will still go through the loop even if the condition is already false. The "extreme case" occurs when the condition is never true. If the process checks the condition before running the loop, then the loop will never execute. If the process checks the condition after running the loop, then even if the condition is always false, the loop will always execute at least once. By default, the process checks the condition before executing the loop.

To add a loop action to a task or state:

  1. Drag the Loop action from the toolbox to the desired location in your state.

    IPA Designer displays the Create Loop Action dialog box (see figure).

  2. Select the radio button for the type of loop you want.

  3. If needed, select the collection to use or add a calculation.

  4. Click OK.