To create limitations and conditions in our web apps, you can write expressions using the following syntax:
fieldpath operator value
Fieldpath:
You can specify what will you would like use in the expression by specifying the path to the field, also known as a fieldpath. A fieldpath is a way to go through connected entities to find a specific field, based on a base/root entity. Ie. if the base entity is operation, you can use a operation field simply by typing its field identifier. This could for example be quantity.
If the base entity is still operation and you would like to use a field on the production order, which the operation belongs to, you can begin the fieldpath with order. following the field identifier – e.g. order.quantity.
Tip: You can find the field identifier using our field chooser (grey text next to the “Properties” title of a selected field):
Possible operators:
Operator | Description |
---|---|
= | Equal to |
!= | Not equal to |
> | Greater than |
>= | Greater than or equal to |
< | Less than |
<= | Less than or equal to |
in | In |
contains | Contains |
Value:
When specifying the value in a expression, you need to pay attention to the data type of the value.
Data type | Value | Description |
---|---|---|
Numeric | 10 | You can enter the numeric value directly |
Text | “text here” | You need to encapsulate the text in either double- or single quotation marks |
List/Array | [10, “text here”] | You wrap multiple values between square-brackets |
Examples of valid expressions
quantity >= 1000
customer.name contains "m"
name in ["name1", "name2"]
Combine multiple expressions
It is possible to join multiple expressions together, either by using the AND operator or the OR operator. Using AND requires both left and right expression to be truthy. If using OR, only one of the sides needs to be truthy.
quantity >= 1000 AND customer.name contains "m"
quantity >= 1000 OR customer.name contains "m"
Configurable field rules
In our field chooser, it’s possible to setup required, enabled and visible rules with conditions, which is specified in our custom CQ filter syntax.
Visual indicator of fields being required
Lets use the condition in the previous picture as an example: quantity >= 45.
If condition is true, the field requires input value, indicated by the red star next to the label, including a warning icon with tooltip text if the required input value has not been entered:
If the condition is true and a input value has been supplied, the field still indicates that an input value is required, but no warning icon is shown:
Otherwise, the field does not require a input value:
Post your comment on this topic.