Repeat while loop
  • 04 Apr 2025
  • 3 Minutes to read
  • PDF

Repeat while loop

  • PDF

Article summary

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:

  1. Define Actions to Repeat (REPEAT): Specify the actions that should be repeated within the loop.

  2. 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

  1. Log in to Integration Hub account. The Orchestrate platform opens by default.

  2. Navigate to Projects.

  3. Click Create button and select Recipe to create a new recipe or choose an existing Recipe and click Edit Recipe.

  4. Click the + (plus) icon under Actions to add a new step.

  5. Select Repeat while.

  6. Choose the application, connection, and action you want to repeat.

  7. Fill in the required fields to complete the action setup.

Figure: Repeat

Step 2: Specify the Condition for Repetition

  1. In the recipe editor, select Set Up Condition to define the criteria for repeating the steps.

    Figure: Set Up condition

  2. Choose a data pill from the Recipe Data interface or manually input a value in the Data Field.

    Figure: While action

  3. Choose a condition from the Condition dropdown menu (example, less than)

  4. Select a data pill from the Recipe Data interface or manually enter a value in the Value field.

  5. (Optional) Click + (plus) below the Value field to add an additional WHILE condition and select a logical operator:

    1. AND: All conditions must be met for the loop to continue.

    2. OR: At least one condition must be met for the loop to continue.

  6. 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

  1. Log in to Integration Hub and go to Projects.

  2. Click Create, then select Recipe to create a new recipe, or choose an existing recipe and click Edit Recipe.

  3. Click the + (plus) button to add a Repeat While step.

  4. Configure the action to be repeated within the loop block.

  5. In the WHILE step of the loop block, set the condition to check if the Index datapill from the REPEAT step output equals 4.


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.