Configuring a For Each Loop

A For Each loop iterates through the selected parameter’s list of values and runs the subflow at each iteration. The values in the list can be either predefined constants or values of other parameters.

The For Each loop and the For loop differ in two ways:

  • In For Each loops, the value list contains any set of values, which are not necessarily evenly spaced.
  • Boolean and string data types can be used in For Each loops, not just integer and real data types.

For information about how parameters other than the loop parameter behave for sequential and parallel For Each loops, see About Parallel Loop Execution.

  1. From the Flow section of the action bar, click Loop and drop it on the process diagram.
  2. Double-click Loop .
    The Loop Editor appears.
  3. From the Loop Editor, click For Each from the Loop Type list.
  4. In the Parameter list, select a parameter or click to create a parameter.

    Boolean, file, real, integer, string, object, and timestamp parameter types can be used in a For Each loop.

    The selected parameter’s value is altered during every run from the values list specified. This values list is determined in the next step.

  5. Select Parameter or Constant from the list in the middle of the editor; based on your selection, select either a parameter using the corresponding list or enter a constant in the adjacent text box.

    Note: All values in the list must match the data type of the selected iteration parameter. For example, Boolean parameter types accept only Boolean values.

  6. Click to add your selection to the Values List area. The loop iterates through these values.

    You can delete an item from the Values List by selecting the item and clicking .

  7. Repeat Step 4 through Step 6 for each item you want to add.
  8. Click and to rearrange the information in the Values List.
  9. In the If a run in a loop fails then list, select the action that you want Optimization Process Composer to take if a subflow fails.
    OptionDescription
    Fail Loop Select this option if you want the Loop adapter to fail when the subflow fails.
    Ignore run and Continue Select this option if you want the run to continue after a subflow fails. This option applies to both parallel and sequential execution.
  10. Click Execute all iterations in parallel if you want all the submitted subflows to run simultaneously (in parallel).

    If not selected, the subflows run one after the other (sequentially).

  11. Select Ok to save your changes and to close the Loop Editor.