Using the ForEach Step

The ForEach step repeats the operations that you specify for each element in a list or multi-item data element. These operations continue to execute until the last element has been processed. Then the orchestration workflow continues to the next step. The ForEach index counts the number of loops, and the ForEach item is the value of the data element at the end of a particular loop.

When you select a ForEach step, the General and Options tabs appear in the Property Editor. The General tab provides a name and optional description for the step. The Options tab defines the source for the multi-item data element.

Note: During loops, the Web service and subroutine inputs retain the data for all transactions. In some cases, this caching may cause issues for subsequent loops. For information on resetting the data collected in these inputs, refer to Resetting Data.

Procedure Summary

  1. Select an orchestration workflow to display it in the orchestration workflow editor.

  2. On the Data Mapping tab of the Property Editor, create an array of working data. (See Creating Arrays of Working Data.)

  3. In the New Items section of the Step Palette, drag and drop a ForEach step onto the line between the Start and End steps.

    The lines from the ForEach step icon travel in two directions. One points to subsequent steps and the other loops back to the ForEach step icon. You place the steps or calculations that are to be repeated on the loop that points to the ForEach step icon.

  4. On the General tab of the Property Editor, you can change the name of the ForEach step and you can also enter a description.

  5. On the Options tab, in the Source section, enter an expression that describes the source of the data to be processed. You can use any of the functions, logical operators, or arithmetic operators available on the Functions, Logical, and Operator menus, respectively.

    For more information about expressions, see About the Expression Editor.

  6. Add other steps from the Step Palette to the repeating section (the top loop) to define the actions that should be taken or calculations that should be performed while there are still members of the data element to be processed.

  7. Add other steps from the Step Palette to the non-repeating section (the bottom loop) to define the actions that should be taken or calculations that should be performed after all of the members of the data element have been processed.

    Tip: To duplicate or delete a ForEach step, right-click the step, and then select the appropriate option. To hide the loops while you work on another part of the orchestration workflow, click the minus sign to the left of the ForEach step.

Related Topics

Creating a Practice Process App for Using the Step Palette

About the Expression Editor

Event Definition Property Editor

Supported XPath Functions