Creating a Multi-Instance Loop

A multi-instance loop is indicated by one of two symbols:

  • Parallel multi-instance loop:

  • Sequential multi-instance loop:



Click the Loops tab to set the details of the loop:

Set the following parameters as appropriate for the loop you want to create:

Ordering

Select either Sequential or Parallel ordering. The Sequential option causes the instances of the activity to occur in succession rather than at the same time. The Parallel option causes the instances of the activity to occur at the same time.

Flow Condition

This property can be used to mimic the functions of a gateway. Select one of the following options:

  • All (perform outgoing flow when all instances complete)  The outgoing flow is processed once after all activity instances have completed.
  • One (perform outgoing flow once when first instance completes)  The outgoing flow is processed when the first activity instance completes (existing instances can still be completed but the outgoing flow is not processed when they complete).
  • No Condition (perform outgoing flow for each completed instance)  The outgoing flow is processed for every activity instance as it completes.
  • Complex (behavior defined by Complex Flow Condition)  The outgoing flow is processed for each instance for which the Complex Flow Condition tab evaluates to true.

Scripts for Multi-Instance

Select Free Text for the Script Defined As field if you want to describe how you would like the loop to be tested, and prefer to leave the specific implementation of the loop expression to someone else. You can also select Unspecified if there is currently no condition or description for the loop.

Note: Depending on the destination environment you have selected, JavaScript may be available as an option. Use this option if you want to enter JavaScript that will be evaluated for the loop expression.

There are three tabs on which you can specify scripts:

Loop Expression
 Specify either a script that evaluates to an integer or a description of the desired script.
Complex Flow Condition
This expression is evaluated if you selected Complex as the Flow Condition.
Additional Instances Expression  
This expression is used for control-flow pattern WCP-15 (additional activity instances may be required at runtime) when you only need to add instances when the task is complete.
See the table "Supported Control Flow Patterns" in the "Workflow Patterns Reference" appendix of the TIBCO ActiveMatrix BPM - BPM Concepts guide. If you need to add instances while the task is in progress, see Adding Additional Instances to a Multi-instance Loop While the Task is Still in Progress.

The additional instances script is evaluated after the last instance completes. If the script evaluation calls for additional instances, they will be done and the script will be evaluated again once the last additional instance completes.

Note: If an Additional Instances Expression is specified then this expression must eventually evaluate to zero so no more instances occur.