Not every series of function calls inside an action has to be fully sequential. NoCode-X allows you to use conditional expressions on the lines between function calls. Based on these expressions, the program can autonomously decide whether the line should be followed or not (meaning the function call is executed).
The two sides of a conditional expression are compared to each other using an equality operator. These two sides are referred to as the Left argument and the Right argument. If the expression is correct, meaning the logical expression is true, the line between the two function calls will be followed. If it is false however, the line will be abandoned.
When an object does not exist, it is equal to null.
Chain conditional expressions together
You can chain different conditions together by choosing a logical operator. This field can be found between every two neighboring conditionals in the Next invocations tab. These are the currently available logical operators in NoCode-X:
|AND||An AND expression is true if and only if both expressions on either side of this operator are true, otherwise it is false. In NoCode-X this operation is represented as “&&”.|
|OR||An OR expression is true if one or more of the two expressions on either side of this operator are true, otherwise it is false. Thus, the OR-expression is only false when both of its expressions are false. In NoCode-X this operation is represented as “||”.|
Create a conditional expression
Follow these steps to add a conditional between two function calls:
- Connect the two function calls. This is explained on the Function picker page.
- Click the line between them.
- Open the Next invocations menu on the right. It looks like the first image below.
- Click the Add a condition button.
- Two tabs appear: Add a condition and Choose an operator. Open the former.
- Then, for both the left and the right argument: choose a variable from the scope, enter a string or choose a boolean value.
- Choose an equality operator to compare both arguments. A list of all operators is found at the bottom of this article.
- An example, where we check whether the first name of the current user equals John, can be seen in the second image below.
- Now, you can create additional conditions and chain them together using the operator fields between each condition. The third image shows an example where the expression is true when the current user is either named John or An (or both, but a user can only have one first name).
All equality operators
- Is not equal to
- Does not contain
- Is bigger than
- Is smaller than
- Is bigger or equals
- Is smaller or equals
- Is not equal to null
- Is equal to null