Use Repeat While to execute a sequence of child steps repeatedly while a condition group evaluates to true. Flowifier checks the conditions before the first iteration and before every later iteration.
Step Library: Flow Control > Loops
When to use this step
Use this step when you want to:
- repeat one or more steps until workflow data meets a stopping condition;
- evaluate several conditions before every iteration;
- use the current one-based iteration number inside the repeated steps.
Common examples include:
- checking a status until work is complete;
- repeating follow-up actions while information is still missing; or
- continuing a process while several required conditions remain true.
Use Repeat a Number of Times instead when the number of repetitions is known. Use For Each Item instead when you want to process every item in a collection.
Before you begin
This step does not require a connection or special permissions.
Create or identify the variables and previous step outputs that the conditions should evaluate. At least one child step should change a value used by the conditions or otherwise end the workflow so that the loop can complete before reaching its iteration limit.
Configure the step
- Add Repeat While from Flow Control > Loops.
- Select the step to open its configuration panel.
- Optional: Enter a descriptive Step Label.
- Under Conditions, select whether all conditions or at least one condition must be met.
- Select Add condition, choose a variable, and select an operator.
- When Comparison value appears, enter a fixed value or select a compatible variable.
- Add further conditions as needed.
- Add the steps that should repeat inside the loop.
- Save or publish the workflow.
Settings
| Setting | Required | Accepted values | Visible when | Description |
|---|---|---|---|---|
| Step Label | No | Fixed Text, up to 80 characters | Always | Optional name for the step. The default is empty, and the Designer displays Repeat While. The label does not affect condition evaluation. |
| Conditions to match | Yes | All conditions must be met or At least one condition must be met | Always | Controls how the condition group is evaluated before every iteration. The default is All conditions must be met. At least one complete condition is required. |
| Select variable | Yes | Start Event, Workflow, Context, or available previous-step variable | Adding or editing a condition | Selects the left side of the condition. There is no default. The variable type determines which operators are available. |
| Operator | Yes | An operator supported by the selected variable type | A variable is selected | Defines how the variable is evaluated. There is no default. Changing the selected variable clears the current operator and comparison value. |
| Comparison value | Yes | Fixed Text, Number, Boolean, or Date value, or a compatible variable | The selected operator compares the variable with another value | Defines the right side of the comparison. It is hidden for operators that do not compare against another value. When a comparison operator is selected, the initial fixed value is empty Text, 0, false, or the current date and time, according to the selected variable type. |
Available operators depend on the selected variable type:
| Variable type | Operators |
|---|---|
| Text | is set, is not set, equals (=), not equals (≠), is empty, is not empty, begins with, does not begin with, ends with, does not end with, contains |
| Number or Date | is set, is not set, equals (=), not equals (≠), is less than (<), is less than or equal (≤), is greater than (>), is greater than or equal (≥) |
| Boolean | is set, is not set, equals (=), not equals (≠), is true, is not true, is false, is not false |
| File, Object, or collection | is set, is not set |
Text comparisons are case-sensitive. Conditions are flat; nested condition groups are not supported. Comparison variables must have the same compatible type as the selected variable.
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. When a child step changes a value used by the condition group, Flowifier evaluates the changed value before the next iteration.
Step outputs
| Step output | Type | Available when | Scope | Description |
|---|---|---|---|---|
| Current Loop Count | Number | During every iteration | Child steps inside the loop | One-based number of the current iteration. The first iteration has the value 1; each new iteration adds 1. |
Current Loop Count is available only to child steps inside the current iteration. It is removed after a completed iteration and is not available to steps following the loop. When the conditions are false before the first iteration, the output is not created.
Runtime behavior
Execution and completion
Before starting every new iteration, Flowifier performs the following actions:
- It evaluates the conditions in their displayed order. With All conditions must be met, evaluation stops when a condition is false. With At least one condition must be met, evaluation stops when a condition is true.
- If the condition group is false, the loop completes without starting another iteration.
- If another iteration would exceed the limit of 1,000 iterations, the loop fails before iteration 1,001 starts.
- It exposes Current Loop Count and executes the child steps sequentially.
After the child steps finish successfully, Flowifier removes the iteration output and evaluates the condition group again. When the condition group becomes false, the workflow continues with the next step following the loop.
Repeat While does not call an external provider and has no external side effects of its own.
Branches and child steps
This step has one child branch. All enabled steps in the branch execute once per iteration and in their configured order. Iterations do not run in parallel.
The branch does not execute when the condition group is false before the first iteration. Workflow variable changes made by child steps are retained. Current Loop Count and outputs created by child steps are limited to the loop branch and the active iteration.
Child steps keep their own external side effects. Repeat While does not roll back completed child steps when a later child step or iteration fails, is cancelled, or ends the workflow. Starting another workflow instance can repeat those effects.
Failure, retry and resume behavior
This step does not automatically retry failed child steps.
If evaluating the condition group fails, Repeat While fails before the next iteration starts. If a child step fails, is cancelled, terminates the workflow, or ends the workflow, the loop propagates that result immediately. It does not run later child steps, start another iteration, or continue with a step following the loop.
If a child step suspends the workflow, for example by pausing for a duration, Repeat While is suspended with it. When the workflow resumes, Flowifier continues the same iteration with the same Current Loop Count. Child steps that completed before suspension do not run again, and the condition group is evaluated again only before the following new iteration.
Cancelling a suspended instance prevents it from resuming. Starting a new instance after a failure or cancellation starts the loop again from its first iteration and can repeat changes or external side effects already completed by child steps.
Errors and limits
| Situation | Result | Resolution |
|---|---|---|
| No condition is configured | The step shows At least one condition is required, and the workflow cannot be published. | Add at least one complete condition. |
| A condition has no variable or operator | The condition cannot be added. | Select a variable and an operator. |
| A required Comparison value is missing | The condition cannot be added or the workflow fails validation. | Enter a fixed comparison value or select a compatible variable. |
| The selected operator is not available for the variable type | The workflow cannot be published with that condition. | Select an operator offered for the current variable type. |
| A fixed Date comparison value is not a valid date and time | The workflow cannot be published. | Enter the value again with the Date and time editor. |
| A value comparison resolves an unset operand | The step fails before the next iteration starts. | Set the referenced value first, or use is set or is not set when an unset value is expected. |
| A comparison value has an incompatible type | The workflow cannot be published or the condition fails at runtime. | Use a fixed value or variable with the same compatible type as the selected variable. |
| Another iteration would exceed 1,000 iterations | The step fails before starting iteration 1,001. | Ensure a child step makes the condition group false or otherwise ends the workflow within 1,000 iterations. |
| A child step fails | The current iteration stops, the loop fails, and later steps do not run. | Inspect the failed child activity under Instance Activities, correct the cause, and start a new instance if appropriate. |
| A child step cancels, terminates, or ends the workflow | The loop stops immediately and propagates the cancellation, termination, or early completion. | Review the child activity that caused the result. |
| A child step creates an external side effect before a later failure | The completed external side effect is not rolled back. | Review partial results before restarting the workflow to avoid duplicate side effects. |
The iteration limit applies to the number of iterations actually started. The loop can successfully complete up to 1,000 iterations.
Example
Log three numbered iterations
Goal: Write three instance-log entries and then continue with the workflow.
Configuration:
- Workflow Number variable:
Loop counter, initially0 - Conditions to match: All conditions must be met
-
Select variable:
Loop counter - Operator: is less than (<)
-
Comparison value:
3 - Child steps:
- Log to Instance Log, using Current Loop Count in the message.
-
Calculate Value, adding
1toLoop counter. -
Set Variable, replacing
Loop counterwith the result from Calculate Value.
Result: The branch runs three times and can create messages equivalent to:
Processing iteration 1 Processing iteration 2 Processing iteration 3
After the third iteration changes Loop counter to 3, the condition is false. The loop completes, the workflow continues with the next step, and Current Loop Count is no longer available.
Related information
- Repeat a Number of Times — repeat child steps a known number of times.
- For Each Item — repeat child steps for every item in a collection.
- Run If — run child steps once when conditions are true.
- Workflow variables — store condition values and values changed by child steps.
Comments
0 comments
Please sign in to leave a comment.