Use Conditions to shape the core logic behind your module. You can use Conditions to determine the user's path through your module in Transitions or to locally affect content in Conditional blocks.
Example use cases
Show/hide content within a node by using Conditional blocks
Sometimes you might want to show or hide part of the content of a node depending on whether certain conditions have been met. You can do this by using Conditional blocks. In the example below, the text inside the first Conditional block about transactions will only be displayed if the conditions to the right are met. Learn more about using Conditional blocks.
Design the user flow through your module by using Transitions
A module is essentially a tree of forking paths which all start at one point: the Start node. Each node is connected to the following node with a Transition. The module can continue to flow in a single path, from one node or action to another, as shown below to the right. Alternatively, the module can split into branching paths, as shown below to the left. In this scenario, the Transition between two nodes is populated with conditional logic. Based on a user's response to a node, you can use conditions to decide which path to send the user down. You can apply conditions to all the preceding nodes in your module, not just the node the Transition is directly connected to. Learn more about using Transitions to connect nodes.
Use Regexp to determine whether a SEPA money transfer is national or international
Regular expressions can be found in both Text nodes (custom validations for the user input field) as well as in Conditions. Regexp can be used to determine whether a SEPA money transfer is national or international.
Example:
[D][E]\d{20}
In this example, our module splits into two different paths โ triggering a different set of questions โ depending on whether a SEPA money transfer is national or international. We are setting the condition that IF the user's IBAN starts with DE ( [D] and [E]) and is followed by exactly 20 digits ( \d{20} ), THEN we are dealing with a national SEPA money transfer. In every other case, the module will automatically follow the path for an international SEPA money transfer.
Tip: Get the most out of your module by using regexp in Text nodes and Conditions. For example, within the node 'payment information' you can include a regular expression to ensure that the user's IBAN starts with two letters and is followed by a minimum of 15 and a maximum of 31 digits (min. and max. length of IBAN in the SEPA countries).
Getting started with conditions
Before we get started with adding conditions to your module or discussing the parameters you can adjust when building a condition, here are some basics about conditional statements.
What are the basic parts of a conditional statement?
Conditional statements consist of two main parts:
An IF statement - This is a condition which must be fulfilled ("true") for an action to occur.
A THEN statement - This is an action which occurs when the condition is fulfilled
For instance, consider the following sentence:
If the volume of transactions is below 10000 EUR, display the text typed into the Conditional block.
The first part of the sentence (If the volume of transactions is below 10000 EUR) is the condition. This must be true in order for the action in the second part of the sentence to occur. That is, if the volume of transactions is not below 10000 EUR, then the module will not display the text in the Conditional block.
How do you create a condition?
In this section, we'll talk about the three parts of a condition which must be met for a subsequent action to occur. Let's take another look at the condition from the example above.
If the volume of transactions is below 10000 EUR...
This condition consists of three parts:
A variable - This is the node or action that is evaluated in this condition. In the example above, the variable is "volume of transactions".
An operator - This is the logical operator which specifies how the variable is related to the value. In the example above, this operator is "is below".
A value - This is the value that you can specify must be met by the variable in the way the operator specifies. In the example above, the value is "10000 EUR".
In your module, this condition would be represented as follows:
The variable can be any preceding node or action in your module, except for: File/Image upload nodes, Send email actions, and Create document actions. The node does not need to be directly adjacent to the node where you're implementing your conditions.
All available operators will automatically populate the middle section once you've selected a variable. Learn more about the types of operators available based on the type of node or action you select in the last section of this article.
Depending on the type of node or action you select, you will be able to either specify a value or select one from a drop-down menu in the right section. Learn about what kind of value you can specify based on the type of node or action you select in the last section of this article.
Learn more about the parameters of a condition below.
What actions occur when Conditions are met in your module?
In your module, there are two types of actions which can occur when conditions are met.
When Conditions are fulfilled in Conditional blocks, the action that occurs is the text you entered into the Conditional block's content area being displayed.
On the other hand, when Conditions are fulfilled in Transitions, the action that occurs is the user being directed to a node of your choosing.
How do you implement Conditions in your module?
There are two main places you can implement Conditions. Learn how to add Conditions in Transitions between nodes and how to add Conditions in Conditional blocks within nodes.
Once you've added a conditional block or transition, you can start to specify your conditions.
Parameters of a simple Condition
In this section, learn about the parameters of a simple Condition. We'll go over the parameters of a complex Condition in a separate section below.
[ 1 ] Variable
As described above, a simple condition consists of three parts: a variable, an operator, and a value. From this dropdown menu, you can select any preceding node in your module to be your variable. This will reference this node's value, which you can then evaluate with an operator against a specific value. In the example above, the variable is the Single select node "Reason".
[ 2 ] Operator
Once you've selected a variable in the left text area, you can choose an operator from the dropdown menu here. The list will automatically populate with all available operators based on the variable you've chosen. The operator determines how you evaluate your variable against the value you specify in the right-most text area. In the example above, the operator is the equal sign '='.
See the last section of this article for an extended list of available operators based on the type of node you've selected as a variable.
[ 3 ] Value
After selecting a variable and choosing an operator from the dropdown menu, you can specify a value. Depending on the variable you selected, you can either enter a free response into the text area or you can choose a value from a dropdown menu. In the example above, the selected value is 'None of the above'.
See the last section of this article for the type of acceptable value based on the type of node you've selected as a variable.
[ 4 ] Trash icon
Use this trash icon to delete the condition directly to the left of the icon.
[ 5 ] Add condition / Add group
Use these to add another condition or add a group of conditions. Learn more about this in the Parameter section for complex conditions below.
[ 6 ] Go to action (for Transitions only)
This parameter is only available for transitions. Use the dropdown menu to specify which node you want to send your user to if the conditions listed above are met.
Keywords: boolean operators; IF; THEN; ELSE; Bedingung