Use Repeat a Number of Times to execute a sequence of child steps repeatedly, up to a configured number of iterations. The repeat count can be a fixed positive integer or a Number variable that is re-evaluated before each iteration.
Step Library: Flow Control > Loops
When to use this step
Use this step when you want to:
- repeat one or more steps a known number of times;
- use the current iteration number inside the repeated steps;
- stop repeating early when a Boolean variable becomes true.
Use For Each Item instead when you want to process every item in a collection.
Use Repeat While instead when the number of repetitions is determined entirely by a condition.
Before you begin
This step does not require a connection or special permissions.
If you want the loop to stop early, create or identify a Boolean variable that the workflow can evaluate before each new iteration.
Configure the step
- Add Repeat a Number of Times from Flow Control > Loops.
- Select the step to open its configuration panel.
- In Repeat count, enter a positive whole number or select a Number variable.
- Optional: In Stop when, select a Boolean variable.
- Add the steps you want to execute inside the loop.
- Save or publish the workflow.
Settings
| Setting | Required | Accepted values | Visible when | Description |
|---|---|---|---|---|
| Repeat count | Yes | Positive whole number or Number variable | Always | Number of times the child steps can run. There is no default value. A loop can start up to 1,000 iterations. Attempting to start iteration 1,001 causes the step to fail. When a Number variable is used, Flowifier evaluates its current value before every new iteration. |
| Stop when | No | Boolean variable | Always | Stops the loop before the next iteration when the selected variable is true. Fixed Boolean values cannot be entered. When no variable is selected, the loop is controlled only by Repeat count. |
Data and outputs
Workflow variable effects
This step does not directly modify workflow variables.
Child steps inside the loop can modify workflow variables. These changes remain available during subsequent iterations and after the loop completes.
If a child step changes the Number variable used by Repeat count, the new value affects the next iteration because Flowifier evaluates the variable again before every new iteration.
If a child step changes the Boolean variable used by Stop when to true, the loop stops before starting the next iteration.
Step outputs
| Step output | Type | Available when | Scope | Description |
|---|---|---|---|---|
| Current Repeat Count | Number | During every iteration | Child steps inside the loop | One-based number of the current iteration. The first iteration has the value 1. |
| Total Repeat Count | Number | During every iteration | Child steps inside the loop | Current value of Repeat count for that iteration. If Repeat count references a variable, this value can differ between iterations. |
The step outputs are available only to child steps inside the loop. They are removed after an iteration finishes and are not available to steps following the loop.
Runtime behavior
Execution and completion
Before starting every new iteration, Flowifier performs the following checks in order:
- If Stop when is configured, Flowifier evaluates the selected Boolean variable.
- If the variable is
true, the loop completes without starting another iteration. - Flowifier evaluates Repeat count.
- If the current number of completed iterations has reached Repeat count, the loop completes.
- Flowifier exposes Current Repeat Count and Total Repeat Count to the child steps.
- The child steps execute sequentially.
After the child steps finish successfully, Flowifier removes the iteration outputs and evaluates whether another iteration should start.
A dynamic Repeat count can increase or decrease while the workflow is running. Changes made by child steps affect the next iteration.
Branches and child steps
This step has one child branch. All steps placed in this branch execute once per iteration and in their configured order.
The branch does not execute when:
-
Stop when is
truebefore the first iteration; or - the configured repetition count has already been reached.
Workflow variable changes made by child steps are retained. The step outputs Current Repeat Count and Total Repeat Count are limited to the child branch.
Failure, retry and resume behavior
This step does not automatically retry failed child steps.
If a child step fails, is cancelled or terminates the workflow, the loop propagates that result and does not start another iteration.
If a child step suspends the workflow, for example by waiting for a task or a specified date, the loop is suspended with it. When the workflow resumes, Flowifier continues the same iteration without incrementing the iteration counter. Stop when and Repeat count are evaluated again before the following new iteration.
Errors and limits
| Situation | Result | Resolution |
|---|---|---|
| Repeat count is missing | The workflow cannot be published with a valid configuration. | Enter a fixed number or select a Number variable. |
| Repeat count contains zero, a negative number or a decimal number | Validation reports that a positive whole number is required. | Enter a whole number of at least 1. |
| A Number variable resolves to an invalid value at runtime | The step fails because it cannot determine a valid repetition count. | Ensure the variable contains a positive whole number before the loop starts and before every subsequent iteration. |
| Stop when does not resolve to a Boolean value | The step cannot evaluate the stop condition and the workflow fails. | Ensure the selected variable exists and contains a Boolean value. |
| Another iteration would exceed 1,000 iterations | The step fails before starting iteration 1,001. | Reduce Repeat count or redesign the workflow to process the work in smaller batches. |
| A child step fails | The loop stops and propagates the failure. | Inspect the failed child step in the workflow instance log. |
| A child step cancels or terminates the workflow | The loop stops immediately and propagates that result. | Review the configuration of the child step that caused the cancellation or termination. |
The iteration limit applies to the number of iterations actually started. A loop can successfully complete up to 1,000 iterations.
Example
Write three numbered entries to the instance log
Goal: Write three log entries that show the current iteration and the total number of repetitions.
Configuration:
-
Repeat count:
3 - Stop when: Not set
- Child step: Log to Instance Log
In the log message, insert Current Repeat Count and Total Repeat Count using the variable picker.
Result: The child step runs three times and can create messages equivalent to:
Processing iteration 1 of 3
Processing iteration 2 of 3
Processing iteration 3 of 3After the third iteration completes, the workflow continues with the next step following the loop. The two loop outputs are no longer available outside the loop.
Related information
- For Each Item — repeat child steps for every item in a collection.
- Repeat While — repeat child steps while a condition remains true.
- Group Steps — organize multiple child steps without repeating them.
- Workflow variables — store and update values throughout a workflow.
Use Repeat a Number of Times to execute a sequence of child steps repeatedly, up to a configured number of iterations. The repeat count can be a fixed positive integer or a Number variable that is re-evaluated before each iteration.
Step Library: Flow Control > Loops
When to use this step
Use this step when you want to:
- repeat one or more steps a known number of times;
- use the current iteration number inside the repeated steps;
- stop repeating early when a Boolean variable becomes true.
Use For Each Item instead when you want to process every item in a collection.
Use Repeat While instead when the number of repetitions is determined entirely by a condition.
Before you begin
This step does not require a connection or special permissions.
If you want the loop to stop early, create or identify a Boolean variable that the workflow can evaluate before each new iteration.
Configure the step
- Add Repeat a Number of Times from Flow Control > Loops.
- Select the step to open its configuration panel.
- In Repeat count, enter a positive whole number or select a Number variable.
- Optional: In Stop when, select a Boolean variable.
- Add the steps you want to execute inside the loop.
- Save or publish the workflow.
Settings
| Setting | Required | Accepted values | Visible when | Description |
|---|---|---|---|---|
| Repeat count | Yes | Positive whole number or Number variable | Always | Number of times the child steps can run. There is no default value. A loop can start up to 1,000 iterations. Attempting to start iteration 1,001 causes the step to fail. When a Number variable is used, Flowifier evaluates its current value before every new iteration. |
| Stop when | No | Boolean variable | Always | Stops the loop before the next iteration when the selected variable is true. Fixed Boolean values cannot be entered. When no variable is selected, the loop is controlled only by Repeat count. |
Data and outputs
Workflow variable effects
This step does not directly modify workflow variables.
Child steps inside the loop can modify workflow variables. These changes remain available during subsequent iterations and after the loop completes.
If a child step changes the Number variable used by Repeat count, the new value affects the next iteration because Flowifier evaluates the variable again before every new iteration.
If a child step changes the Boolean variable used by Stop when to true, the loop stops before starting the next iteration.
Step outputs
| Step output | Type | Available when | Scope | Description |
|---|---|---|---|---|
| Current Repeat Count | Number | During every iteration | Child steps inside the loop | One-based number of the current iteration. The first iteration has the value 1. |
| Total Repeat Count | Number | During every iteration | Child steps inside the loop | Current value of Repeat count for that iteration. If Repeat count references a variable, this value can differ between iterations. |
The step outputs are available only to child steps inside the loop. They are removed after an iteration finishes and are not available to steps following the loop.
Runtime behavior
Execution and completion
Before starting every new iteration, Flowifier performs the following checks in order:
- If Stop when is configured, Flowifier evaluates the selected Boolean variable.
- If the variable is
true, the loop completes without starting another iteration. - Flowifier evaluates Repeat count.
- If the current number of completed iterations has reached Repeat count, the loop completes.
- Flowifier exposes Current Repeat Count and Total Repeat Count to the child steps.
- The child steps execute sequentially.
After the child steps finish successfully, Flowifier removes the iteration outputs and evaluates whether another iteration should start.
A dynamic Repeat count can increase or decrease while the workflow is running. Changes made by child steps affect the next iteration.
Branches and child steps
This step has one child branch. All steps placed in this branch execute once per iteration and in their configured order.
The branch does not execute when:
-
Stop when is
truebefore the first iteration; or - the configured repetition count has already been reached.
Workflow variable changes made by child steps are retained. The step outputs Current Repeat Count and Total Repeat Count are limited to the child branch.
Failure, retry and resume behavior
This step does not automatically retry failed child steps.
If a child step fails, is cancelled or terminates the workflow, the loop propagates that result and does not start another iteration.
If a child step suspends the workflow, for example by waiting for a task or a specified date, the loop is suspended with it. When the workflow resumes, Flowifier continues the same iteration without incrementing the iteration counter. Stop when and Repeat count are evaluated again before the following new iteration.
Errors and limits
| Situation | Result | Resolution |
|---|---|---|
| Repeat count is missing | The workflow cannot be published with a valid configuration. | Enter a fixed number or select a Number variable. |
| Repeat count contains zero, a negative number or a decimal number | Validation reports that a positive whole number is required. | Enter a whole number of at least 1. |
| A Number variable resolves to an invalid value at runtime | The step fails because it cannot determine a valid repetition count. | Ensure the variable contains a positive whole number before the loop starts and before every subsequent iteration. |
| Stop when does not resolve to a Boolean value | The step cannot evaluate the stop condition and the workflow fails. | Ensure the selected variable exists and contains a Boolean value. |
| Another iteration would exceed 1,000 iterations | The step fails before starting iteration 1,001. | Reduce Repeat count or redesign the workflow to process the work in smaller batches. |
| A child step fails | The loop stops and propagates the failure. | Inspect the failed child step in the workflow instance log. |
| A child step cancels or terminates the workflow | The loop stops immediately and propagates that result. | Review the configuration of the child step that caused the cancellation or termination. |
The iteration limit applies to the number of iterations actually started. A loop can successfully complete up to 1,000 iterations.
Example
Write three numbered entries to the instance log
Goal: Write three log entries that show the current iteration and the total number of repetitions.
Configuration:
-
Repeat count:
3 - Stop when: Not set
- Child step: Log to Instance Log
In the log message, insert Current Repeat Count and Total Repeat Count using the variable picker.
Result: The child step runs three times and can create messages equivalent to:
Processing iteration 1 of 3
Processing iteration 2 of 3
Processing iteration 3 of 3After the third iteration completes, the workflow continues with the next step following the loop. The two loop outputs are no longer available outside the loop.
Related information
- For Each Item — repeat child steps for every item in a collection.
- Repeat While — repeat child steps while a condition remains true.
- Group Steps — organize multiple child steps without repeating them.
- Workflow variables — store and update values throughout a workflow.
Comments
0 comments
Please sign in to leave a comment.