Condition (If)
The If condition statement allows you to specify that a set of actions should only be performed if one or more conditions are met. It also allows you to specify actions to take if the conditions are not met.
The Condition statement is located under Common Statements in the Assets Panel.
After dragging an If statement into the Builder area, you must specify:
-
Properties: The two variables or values two compare. They must both be of the same type.
You must specify the parameter on the left first.
You can enter a value or click the placeholder to open the Selector window. You can select a simple variable, a property of a complex variable, or any function or method that does not have input parameters.
-
Operator: The comparison operator, for example Equals or Is Less Than. Which operators are listed depends on the type of the property specified on the left. Some operators require only one property to be specified.
-
Then: Drag functions and methods from the Assets Panel into the Then area to specify the actions to perform if the conditions are met.
-
Else: Drag functions and methods from the Assets Panel into the Else area to specify the actions to perform if the conditions are not met.
For example, this workflow step sets the monthly fee for a customer. If the customer's Age is smaller than 18, the Monthly_Fee is set to 100. Otherwise it is set to 180.
The list of comparison operators displayed depends on the type of values entered into the properties of the If statement. For example, for text values the list of comparison operators includes is empty, matches, and contains. Those options are not available if number values are entered. The table below lists the operators and explains how they are applied to each variable type.
Operator |
Text |
Number & Decimal |
Date/Time |
Boolean |
---|---|---|---|---|
equals | The two strings are identical and are of same case. | The values are equal. | Both dates and times are equal. | The values are equal. |
equals (ignore case) |
The two strings are identical. If the only differences are in case, the strings are considered equal. |
N/A | N/A | N/A |
Operator |
Text |
Number & Decimal |
Date/Time |
Boolean |
---|---|---|---|---|
does not equal |
The two strings are not the same or not of the same case. |
The values are not equal. | The dates and/or times are not equal. | The values are not equal. |
does not equal (ignore case) |
The two strings are not the same. If the only differences are in case, the strings are considered equal. |
N/A | N/A | N/A |
is larger than |
The left string is alphabetically later than the right string. |
The left value is larger than the right value. | The left date/time is later than the right date/time. | N/A |
is smaller than |
The left string is alphabetically earlier than the right string. |
The left value is smaller than the right value. | The left date/time is earlier than the right date/time. | N/A |
is not larger than | The left string is not alphabetically later than the right string. | The left value is not larger than the right value. | The left date/time is not later than the right date/time. | N/A |
is not smaller than |
The left string is not alphabetically earlier than the right string. |
The left value is not smaller than the right value. | The left date/time is not earlier than the right date/time. | N/A |
contains | The left string contains the text in the right string in the same case as in the right string. | N/A | N/A | N/A |
contains (ignore case) | The left string contains the text in the right string but not necessarily in the same case as in the right string. | N/A | N/A | N/A |
does not contain | The left string does not contain the text in the right string in the same case as in the right string. | N/A | N/A | N/A |
does not contain (ignore case) | The left string does not contain the text in the right string. Differences in case are ignored. | N/A | N/A | N/A |
is empty | The string is empty. | N/A | N/A | N/A |
is not empty | The string is not empty. | N/A | N/A | N/A |
matches (wildcard) |
The two strings are identical and are of same case. Wildcards are supported:
|
N/A | N/A | N/A |
matches (wildcard, ignore case) |
The two strings are identical. If the only differences are in case, the strings are considered to match. Wildcards are supported:
|
N/A | N/A | N/A |
does not match (wildcard) |
The two strings are not the same or not of the same case. Wildcards are supported:
|
N/A | N/A | N/A |
does not match (wildcard, ignore case) |
The two strings are not the same. If the only differences are in case, the strings are considered to match. Wildcards are supported:
|
N/A | N/A | N/A |
Specify Multiple Conditions
You can specify multiple conditions and choose whether to apply AND or OR logic:
-
AND: Perform the specified actions if both conditions are met.
-
OR: Perform the specified actions if at least one of the conditions is met.
Continuing the example above, the workflow below includes a second condition so that the Monthly_Fee will be set to 100 if the customer's Age is lower than 18 OR if the customer's Birthday_Month is equal to the current month.
To add a (sibling) condition:
-
Click next to the existing condition.
A sibling condition is displayed.
-
Choose whether to apply AND or OR logic.
-
If necessary, click:
-
to add another condition.
-
to delete a condition.
-
Group Conditions
When specifying more than two conditions, it is often necessary to group conditions to ensure that the AND and OR logic operators are applied correctly and to make the conditions more readable.
Continuing the example above, we will specify that customer's over 18 will only be charged the lower rate during their birthday month on condition that they are not in arrears - if they have an outstanding debt they will be charged the higher rate.
The Monthly_Fee will now be set to 100 if:
-
The customer's Age is lower than 18, or:
-
The customer's Birthday_Month is the same as the current month
AND
The customer's In_Arrears value is False.
The last two conditions must be grouped because customers under 18 must be charged the lower rate even if they are in arrears.
You can create subgroups within a group.
You cannot move conditions between groups.
To create groups of conditions:
-
Click next to the condition that you want to add to a group.
A group is created and a new blank condition is added to the group.
-
Specify the properties of the new condition and select the logic operator to apply to the conditions in the group.
-
You can ungroup a group if needed.
Copy and Paste Actions
You can copy and paste actions within, and between the following assets:
- Steps
- Worklfows
- User-Defined Functions
- Transitions
- Triggers
- Callout control actions
- If statements
To copy an action, right-click the action > Copy.
To paste an action, right-click the action Builder > Paste.