Do-While Loop (Beta)
Estimated reading: 3 minutes
The Do-While Loop is a flow control component that repeatedly executes a connected workflow based on a specified condition. The workflow executes at least once before the condition is checked. After each iteration, the component evaluates the condition and continues the loop when the condition is True. The loop stops when the condition evaluates to False. Only the result from the last iteration is retained.
Note: This component is currently in Beta version.
Parameters
| Parameter | Description |
|---|---|
| Initial Input | Connect the Initial Input node to the value that you want to pass to the loop when it starts. This value is used as the input for the first iteration of the loop. |
| Condition |
Specifies the comparison rule used to determine whether the loop should continue after each iteration. Supported options: Equal, Not Equal, Contains, Not Contains, and Regex. The loop continues when the selected condition evaluates to True and stops when it evaluates to False. Default: Equal. |
| Input to Match |
Specifies the value to compare against the output of each loop iteration. Enter a key:value pair to compare a specific field, such as status: completed, or enter a value to compare directly against the entire iteration output. |
| Enable Max Iterations |
Enables an execution limit on the loop. When disabled, the loop moves through the Initial Input items one by one. It processes each item once and stops immediately when the condition evaluates to False. When enabled, the loop enforces the Max Iterations limit. |
| Max Iterations |
Specifies the maximum number of times the loop can execute when Enable Max Iterations is enabled. Enter a positive integer to set the iteration limit. A value of 0 or a negative value uses the Run Infinitely setting. Default: 0. |
| Run Infinitely |
Determines whether the loop can continue indefinitely when Enable Max Iterations is enabled and Max Iterations is set to 0 or a negative value. When enabled, the loop continues as long as the condition evaluates to True. When disabled, the workflow stops with a runtime error instead of running indefinitely. |
| Loop (∞) |
Receives the output from the downstream component connected to the loop. Supports JSON and Message input types. To continue the loop, connect the Item output to the downstream component and connect the downstream component's output back to the Loop (∞) input. The returned output is then evaluated against the configured Condition and Input to Match values to determine whether the loop continues. |
Condition Options
| Option | Description |
|---|---|
| Equal | Continues the loop when the current value matches the expected value. Stops when they are different. |
| Not Equal | Continues the loop when the current value does not match the expected value. Stops when they match. |
| Contains | Continues the loop when the current value contains the specified text or value. Stops when it does not contain it. |
| Not Contains | Continues the loop when the current value does not contain the specified text or value. Stops when it contains it. |
| Regex | Continues the loop when the current value matches the specified regular expression pattern. |
Outputs
| Output | Description |
|---|---|
| Item | Connects to the input of downstream components to pass the data payload into the loop body for processing during each iteration cycle. Supports JSON and Message inputs. |
| Done | Returns the final result after the loop completes and the condition evaluates to False. Provides the result as a Table. |
Limitation
When connecting the Invoke Flow component to the Loop () output, ensure that the Initial Input is also connected to the Do-While Loop component. This connection is required for the loop to process the input correctly.