Expressions
Expressions have to be written within double curly brackets {{ ... }}.
You can combine and nest as many expression types as you want. Do not nest the curly brackets but only the functions and operators itself. You can open and close multiple expressions in one string.
Expressions can be used in following places:
- In the content of data display items, so for example within the content of a
TextBlock - In the expressions property of rules
Available expressions
Section titled “Available expressions”| Type | Example | Comment |
|---|---|---|
| Input value | {{ [myID] }} | Use the id of the input that you want to insert |
| Add | {{ [x] + 4 }} | |
| Substract | {{ 10 - [x] }} | |
| Multiply | {{ [x] * 5 }} | |
| Divide | {{ [x] / 5 }} | |
| Modulus | {{ [x] % 3 }} | |
| Power | {{ [x] ^ 2 }} | |
| Smaller | {{ [x] < 2 }} | Only for numbers |
| Smaller or equal | {{ [x] <= 2 }} | Only for numbers |
| Greater | {{ [x] > 2 }} | Only for numbers |
| Greater or equal | {{ [x] >= 2 }} | Only for numbers |
| Equal (numbers) | {{ [x] == 2 }} | Only for numbers |
| Not equal (numbers) | {{ [x] != 2 }} | Only for numbers |
| Condition | {{ [x] > 5 ? 10 : 0 }} | |
| Round | {{ round([x] / 7) }} | |
| Round up | {{ ceil([x] / 7) }} | |
| Round down | {{ floor([x] / 7) }} | |
| Square root | {{ sqrt([x]) }} | |
| Minimum | {{ min([x], [y]) }} | |
| Maximum | {{ max([x], [y]) }} | |
| String length | {{ length("[x]") }} | Add quotes (' or ") so that the value is interpreted as string |
| String concatenation | {{ concat("[x]", "[y]") }} | |
| Substring | {{ "[x]"[1:5] }}` `{{ "[x]"[1] }} | Index starts at 1 |
| Split before | {{ splitBefore("[x]", "-") }} | Returns the substring until the first occurrence of the second parameter |
| Split after | {{ splitAfter("[x]", "-") }} | Returns the substring after the first occurrence of the second parameter |
| Split item | {{ splitItem("[x]", "-", 1) }} | Returns the nth (third parameter) substring when splitting the string at every occurrence of the second parameter, starting with 0 |
| Replace | {{ replace("Hello World", " ", ", my ") }} | |
| Includes | {{ includes("Hello World", "World") }} | |
| Equals | {{ equals("[x]", "GPU") }} | Works with every data type |
| And | {{ [x] == 5 and [y] != 5 }} | |
| Or | {{ [x] == 5 or [y] < 8 }} | |
| Xor | {{ [x] == 5 xor [y] > 8 }} | |
| Not | {{ not [x] == 5 }} | |
| Grouping | {{ ([x] + 5) * 10 }} | Use ` () ` to prioritize certain parts of an expression |