Conditions
Last updated
Last updated
Conditions are used to compare values at runtime and add dynamic behavior to your apps. They are configured in the same way as , but a condition will always return a true or false value. Conditions can be implemented when designing the (for example to set the Visibility property of a component), or building logic in (for example in an ).
To build conditions, you should also be familiar with .
Conditions are constructed using the condition editor. The most basic condition is a single expression made up of a left operand, an operator, and a right operand.
In the example below, the left operand is Ticket.Status
, the operator is Equals
and the right operand is New
. The condition is evaluated at runtime and if the status of the ticket is new, the condition will return true.
A condition can also consist of multiple expressions. When you add an additional expression the new expression is compared to the previous expression with an AND operator. This means that both expressions must equate to true for the condition to return true. You can click the operator to toggle to OR and in that case, if either expression equates to true the condition will return true.
In the example below, the ticket status must be new and the description must contain a value (not empty or null) for the condition to return true.
Expressions can be combined within groups, and the result of the expressions within a group can be compared.
In the example below, the ticket status must be new and the description must contain a value (not empty or null) or the ticket must have been created prior to the start of the 2022. If either of these equate to true the condition will return true.
You can add a comment to a condition, and it can be useful to describe how a condition works when it contains many expressions.
Here are some example setups of valid conditions, given the following data sources:
Person
(Cardinality One)
With a property Department
(with cardinality One)
With a property Tags
(with cardinality Many)
Departments
(Cardinality Many)
Tags
(Cardinality Many)
This example is similar to example 1, but the right side is a single property itself. App Variables is in fact a single cardinality Data Source, and we've added a variable Selected Department
to it.
In the above example, the left operand is a single value, similar to the previous examples. However, since the operator EXISTS IN
is used, the right side is multiple values. In this case, the right side is a list of the IDs of the selected object in the Departments
Data Source.
In the above condition, we check if the Person.Tags
list contains some of the selected objects in the Tags
data source.
The right operand may be a single value/object or a list of values/objects, whereas the left operand may only be a single value or object, except in the case where the left operand is a property with (see example 5).
In the above example, the left operand is a single value. Since the EQUALS
-operator is used, the right operand must be a single value. The right operand is treated as a single value if the Departments
Data Source has a single , or if the Departments Data Source has a (i.e. this condition is placed inside an iterator, such as inside a Foreach action node, looping the Departments Data Source).
In this example, the left operand is still a single value. However, since the Departments Data Source has cardinality many, the above expression is only valid if the Departments
Data Source has a single , or if the Departments Data Source has a (i.e. this condition is placed inside an iterator, such as inside a Foreach action node, looping the Departments Data Source).
In this example, we have a condition towards the multi-reference property Person.Tags
. You may read more about multi-references if you are new to the concept, but in general, it is just a list of IDs (referencing 0 to many Tags
in this example).
You may read more about these multi-reference operators (Has All Of, Has Some Of, Has None Of) .
In some cases, it may not be possible to create the condition you need in the condition editor. If so, you can instead write a function that returns either true
or false
. See for examples of advanced conditions.