- 04 Apr 2025
- 3 Minutes to read
- Print
- PDF
Repeat while loop
- Updated on 04 Apr 2025
- 3 Minutes to read
- Print
- PDF
Repeat While loop
A Repeat While loop executes the actions within a block at least once and continues looping as long as the specified condition is met. This type of Repeat control statement is also known as a Do While loop, as it performs one or more actions while the condition remains true.
To add a Repeat while loop to a recipe, click the + (plus) button in the recipe editor to create a new step, and then select Repeat while.
Figure: Recipe steps
Integration Hub inserts a block of steps into the recipe where you can configure the app and the action to perform while a condition is met.
A Repeat While loop is applicable in scenarios such as the following:
Retrieving paginated data using an offset value or a next-page token.
Executing one or more actions a set number of times.
Repeating actions until a specific condition is met.
Loop Iteration Limit
A Repeat While loop can iterate up to 50,000 times. This limit prevents excessive task consumption. Ensure the condition is designed to allow the loop to exit appropriately.
For instance, if an action repeats while a variable remains true, but there is no logic to change it to false, the loop will continue indefinitely until it reaches the iteration limit.
How to Create a Repeat While Conditional Loop?
Creating a Repeat While loop involves the following steps:
Define Actions to Repeat (REPEAT): Specify the actions that should be repeated within the loop.
Define a Condition to Check (WHILE): Set a condition that determines when the loop should continue or stop.
Note
Actions execute at least once
Since this is a Do-While loop, the actions inside the loop will execute at least once before the condition is checked. If the condition is met, the loop will continue repeating.
Step 1: Define Actions to Repeat
Log in to Integration Hub account. The Orchestrate platform opens by default.
Navigate to Projects.
Click Create button and select Recipe to create a new recipe or choose an existing Recipe and click Edit Recipe.
Click the + (plus) icon under Actions to add a new step.
Select Repeat while.
Choose the application, connection, and action you want to repeat.
Fill in the required fields to complete the action setup.
Figure: Repeat
Step 2: Specify the Condition for Repetition
In the recipe editor, select Set Up Condition to define the criteria for repeating the steps.
Figure: Set Up condition
Choose a data pill from the Recipe Data interface or manually input a value in the Data Field.
Figure: While action
Choose a condition from the Condition dropdown menu (example, less than)
Select a data pill from the Recipe Data interface or manually enter a value in the Value field.
(Optional) Click + (plus) below the Value field to add an additional WHILE condition and select a logical operator:
AND: All conditions must be met for the loop to continue.
OR: At least one condition must be met for the loop to continue.
Multiple conditions can be added, but all must follow the same logical operator.
Execute a Fixed-Count Loop
The Fixed-Count loop runs for a predetermined number of iterations. To implement this, use the Index datapill, which automatically tracks the loop's iteration count and is available in the output of the REPEAT step.
The loop terminates when the Index value reaches 4.
For Example, to configure the loop, perform an action exactly five minutes:
Data Field: Index data pill
Condition: Equal
Value: 4
Figure: Fixed loop count
Log in to Integration Hub and go to Projects.
Click Create, then select Recipe to create a new recipe, or choose an existing recipe and click Edit Recipe.
Click the + (plus) button to add a Repeat While step.
Configure the action to be repeated within the loop block.
In the WHILE step of the loop block, set the condition to check if the Index datapill from the REPEAT step output equals 4.