Conditions
Conditions are an array of objects. Every object describes a single condition.
You can define a simple array of objects. Then every condition has to be fulfilled to show the field.
If you want to combine multiple conditions with a more complex logical structure, please take a look to "Nesting and combining conditions".
Examples
One simple condition
conditions: [
{
field: "hasShoes",
operator: "==",
value: "no",
}
]
The value of hasShoes has to be no to show this block.
More than one simple condition
conditions: [
{
field: "age",
operator: ">=",
value: 18,
},
{
field: "age",
operator: "<",
value: 60,
}
]
The value of age has to be greater or equal than 18 and has to be less than 60 to show this block.
Comparators
==
value has to equal the given value.
!=
value has to be everything except the given value
>
value has to be greater than the given value
>=
value has to be greater or equal than the given value
<
value has to be less than the given value
<=
value has to be less or equal than the given value
Nesting and combining condiitions
You can nest and combine conditions. Therefore the conditions should be an object instead of an array.
They can be combined with the operators AND and OR.
Example 1: Simple OR
"conditions": {
"AND": [
{
"field": "age",
"operator": "<",
"value": 18
},
{
"field": "age",
"operator": ">",
"value": 60
}
]
}
The field age has to be smaller than 18 or greater than 60
Example 2: use logical OR with AND
"conditions": {
"OR": [
{
"field": "age",
"operator": ">",
"value": 18
},
{
"field": "permissionOfParents",
"operator": "==",
"value": true
}
],
"AND": [
{
"field": "age",
"operator": "<",
"value": 60
}
]
}
Either the field age is greater than 18 or the field permissionOfParents is true. In both cases the age has to be less than 60.