Groups
Groups consist of one or more activities that are assembled together and executed according to their type.
Groups enable you to put one or more activities together and configure the group as needed. For example, defining a single error condition for the group, or creating a group as a transaction that commits to a database only when all the activities in the group are completed.
Every group contains a GroupStart
element on the left and a GroupEnd
element on the right.
![](GUID-DEC6D8E9-0CB4-4D96-A7F3-166521C021DB-display.jpg)
Groups can be classified into two categories: groups with conditions (repetitive groups) and groups without conditions (non-repetitive groups).
Groups Without Conditions (Non-repetitive)
The following types of groups do not require any conditions to be defined for their execution:
- Scope
: A scope is a simple group that has no custom behavior. It can define local variables and can also contain fault handlers and event handlers. A scope with a single activity can be defined if you need to handle faults or catch exceptions specific to an individual activity.
- Critical Section
: Critical Section groups are used to synchronize jobs so that only one job is acting on the group of activities at any given time. Any concurrently running job that contains a corresponding critical section waits until the job currently executing the critical section completes. Critical section groups are useful to control concurrent access to shared variables. While a critical section group can be used to synchronize jobs within a process, module shared variables help synchronize jobs for multiple processes.
Groups With Conditions (Repetitive)
Loops are groups with conditions which follow a pattern at runtime: initialize the loop, update the loop at each iteration, and test conditions for the loop to stop iterating. The following types of loops are available:
- For Each
: For Each is used to loop for a specific number of iterations with a counter ranging from a start value to an end value.
- Iterate
: This loop has a simple index variable that can be used to count each iteration and the loop executes for the number of iterations specified.
- Repeat
: This loop has a simple index variable that can be used to count each iteration and has a conditional expression to determine when to stop. The loop executes at least once and a test for the specified condition is performed at the end of the loop. The Repeat loop continues to execute until the condition evaluates to true.
- Repeat on Error
: This loop involves a retry mechanism: if any activity in the loop throws a fault, the condition expression is evaluated to determine if the loop should be repeated. An index allows the condition to be based on the number of previous attempts, but any condition expression may be used.
- While
: This loop has a simple index variable that can be used to count each iteration. It has a conditional expression to determine when to stop. The condition for the While loop is tested at the beginning of each iteration. The loop may never be executed if the condition is initially false: it continues to execute as long as the condition holds true, and stops when the condition becomes false.