For Activity
Purpose: Iterate over a sequence of steps between a start and an end number. This activity provides a traditional for-loop functionality in workflows.
Input Properties
The starting number for the loop iteration.
Type: int
Default: 0
Required: Yes
The ending number for the loop iteration.
Type: int
Default: 0
Required: Yes
The step size for each iteration. To count down, enter a negative number.
Type: int
Default: 1
Required: Yes
Note: Positive values count up, negative values count down.
Controls whether the end step is inclusive or exclusive. True (inclusive) by default.
Type: bool
Default: true
Note: When true, the end value is included in the loop. When false, the loop stops before reaching the end value.
Output Properties
The current value in the loop iteration.
Type: int
Note: This output is automatically set to the current iteration value. Available in the loop body.
Port Properties
The activity to execute for each iteration.
Type: IActivity
Note: Connect the activity or sequence of activities you want to execute in each loop iteration.
Usage Example
Scenario: Loop from 1 to 10 Configuration: - Start: 1 - End: 10 - Step: 1 - OuterBoundInclusive: true - Body: Connect to activities that process each iteration Result: - The Body activity executes 10 times (for values 1 through 10) - CurrentValue contains the current iteration number (1, 2, 3, ..., 10)
Scenario: Count down from 10 to 1 Configuration: - Start: 10 - End: 1 - Step: -1 - OuterBoundInclusive: true - Body: Connect to activities Result: - The Body activity executes 10 times (for values 10 down to 1) - CurrentValue contains the current iteration number (10, 9, 8, ..., 1)
Important Notes
- The loop executes sequentially from Start to End
- If Start equals End and OuterBoundInclusive is true, the loop executes once
- Use the Break activity inside the loop body to exit early
- The CurrentValue output is automatically updated on each iteration
- A variable named "CurrentValue" is automatically available in the loop body
- For iterating over collections, consider ForEach activity instead
- When OuterBoundInclusive is false, the end value is not included in the loop