Use an If/Else conditional statement to determine the steps that should be followed by the Flow.
When the condition you specify is evaluated, depending on whether the result is true or false, the Flow follows a specific sub-path of Action and Function cards prior to returning optional Outputs, and then continues with the rest of the Flow.
The If/Else card has three sections:
- Condition: Specifies the comparison (a true/false statement)
- Branches: Specifies the Actions and Functions to execute based on the result of the condition.
- Output Fields: Specifies the optional Outputs for the If/Else card, after the proper path has run.
Condition: Defining a Comparison Statement on an If/Else Card
- value a: the value to be compared
- comparison: what comparison to make (see table below)
- value b: the value to compare against
Click Done to advance to the next step. Afterwards, click on the condition to return to this step.
NOTE Be sure to set the type of value a and value b to reflect how you would like the comparison to be done. For instance, the operator “greater than” compares numbers based on numeric value but text based on alphabetical sort order. So the number comparison 80 > 9 is true, but the text comparison “80” > “9” is false.
Table of Relational Operators
Operator | Use Case |
---|---|
equal to | Compares two texts, numbers, dates or true/false to see if they have the same value |
not equal to | Compares two texts, numbers, dates or true/false to see if they have different values |
greater than or equal | Compare two texts, numbers or dates to see if the first has the same or greater value than the second. |
less than or equal | Compares two texts, numbers or dates to see if the first has the same or lesser value than the second. |
greater than | Compares two texts, numbers or dates to see if the first has a greater value than the second. |
less than | Compares two texts, numbers or dates to see if the first has a lesser value than the second. |
a multiple of | Compares two numbers to see if value a is an exact multiple of value b. For example, 12, 0 and -4 are all multiples of 4, but 2, 3 and 7 are not. |
in | Compares two texts to see if value a is a part of value b. For example, “test” is in “this is a test”, but there is no “i” in “team”) |
not in | Compares two texts to see if value a is not part of value b. |
has key | When value a is an object and value b is text, tests to see if the object has a key with the specified name. For example, true if value a is {“test”:123} and value b is “test”. |
doesn’t have key | When value a is an object and value b is text, tests to see if the object does not have a key with the specified name. |
is empty | Checks to see if value a is empty; ignores value b. What defines “empty” varies by type. NOTE This operator works only for text and objects. |
is not empty | Checks to see if value a is not empty. NOTE This operator works only for text and objects. |
Branches: Defining Branch Paths on an If/Else Card
You can specify the Action and Function cards to execute based on the outcome of the comparison. The two branching paths are shown when you click “Done” after defining the Condition.
Actions and Functions within the upper orange container in the Branches tab are executed in sequential order if the conditional statement provided by the Input Fields returns true. Likewise, Actions and Functions within the lower blue container are executed in sequential order if the conditional statement returns false.
You can include any number of Actions within each container. It is also possible to nest an If/Else within another If/Else, which can enable you to create many different branching paths, all with their own set of Actions.
Output Fields: Adding Output Fields to an If/Else Step
The Create Outputs button allows you to add optional Output fields to the entire If/Else step. Their values are assigned after either of the two branches has completed, before moving onto the next Action or Function in the Flow.
To add a new output field:
- Click the “Create outputs” button if the outpane box is not visible at the right.
- Type the desired name in the Outputs box at the right.
- Choose the proper type (e.g. Text or Number) for the output.
- Provide the value for the output for the case where the true branch was run and for the case where the false branch was run. You can drag/drop from the corresponding branch or click inside the box to choose from the outputs of the steps that ran within that branch.