If Control Statements
  • 04 Apr 2025
  • 1 Minute to read
  • PDF

If Control Statements

  • PDF

Article summary

If Control Statements

An IF control statement enables logical branching in Integration Hub recipes, guiding the recipe’s execution based on defined conditions. This section covers effective management of conditional logic and outlines the flow of conditional branches.

Managing Conditional Logic with IF Control Statements

The IF control statement sequentially evaluates each branch and stops when a condition is met:

  • IF: The initial condition is checked first.

  • ELSE IF: If the IF condition is false, this condition is evaluated. Multiple ELSE IF conditions can be added in sequence.

  • ELSE: Executes only if none of the previous conditions are met.

Figure: If condition

This process ensures that only one branch is executed, preventing overlaps or unintended actions.

Overlapping Conditions

Overlapping conditions can cause multiple logic blocks to execute simultaneously, leading to unintended behavior. The IF-ELSE IF structure ensures that only one logic block runs, preventing execution conflicts.

Revising Conditions

Previously, adding or removing conditions required extensive restructuring of IF-ELSE logic, increasing the risk of errors. With IF control statements, conditions can be modified smoothly, preserving the integrity of the recipe.

Improving Readability

While nested IF conditions do not necessarily slow down execution, they can reduce clarity and make debugging more challenging. Using IF-ELSE IF structures result in cleaner, more manageable recipes, avoiding the complexity of deeply nested conditions.

Repeat Control Statements (Loops)

Repeat control statements enable the repetition of a set of steps based on specific criteria. Integration Hub provides two types of Repeat control statements:

Repeat While

Executes one or more actions repeatedly while a specified condition remains true. The loop automatically stops once the condition is no longer met.
Example: Retrieving the next page of Google Drive search results until there are no more pages left.

Repeat For Each

Executes one or more actions for every item in a list. The loop ends when all items have been processed.
Example: Downloading each file from a list of Google Drive search results.

Note

By default, the Repeat For Each control statement processes list items one at a time or in batches.

The following diagrams illustrate the logic of Repeat While and Repeat For Each loops.

Figure: Repeat while loop

Figure: Repeat for each loop


Was this article helpful?

What's Next
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.