Condition expressions
Operators
Operator |
Name |
Syntax |
Associativity |
Example |
Result |
(, ) |
Grouping |
(x) |
None |
2 * (3 + 4) |
14 |
and |
Logical and |
x and y |
L🡒R |
true and false |
false |
or |
Logical or |
x or y |
L🡒R |
true or false |
true |
is |
Equal |
x is 5 |
L🡒R |
5 is 6 |
false |
not |
Unequal |
x not 5 |
L🡒R |
5 not 6 |
true |
in |
Existential |
x in y |
L🡒R |
cat in [cat,dog] |
true |
!in |
Existential |
x !in y |
L🡒R |
cat !in [cat,dog] |
false |
exists |
Existential |
x exists |
L🡒R |
user active program exists |
** |
empty |
Existential |
x empty |
L🡒R |
user active program empty |
** |
includes |
List test |
x includes 'cat' |
L🡒R |
user label includes [star] |
** |
excludes |
List test |
x excludes 'cat' |
L🡒R |
user label includes [star] |
** |
== |
Equal |
x == y |
L🡒R |
2 == 4 |
false |
!= |
Unequal |
x != y |
L🡒R |
2 != 3 |
true |
< |
Smaller |
x < y |
L🡒R |
2 < 3 |
true |
> |
Larger |
x > y |
L🡒R |
2 > 3 |
false |
<= |
Smallereq |
x <= y |
L🡒R |
4 <= 3 |
false |
>= |
Largereq |
x >= y |
L🡒R |
2 + 4 >= 6 |
true |
Objects
user
: session user
group
: active groups
label
: active labels
program
: history
active program
: current
active program-group
: current
membership
: external status
- Values: self, other, admin
values
: based on input
profile
: name, first, last, timzeone, email, role, locale, translate, gender, genderDetail, age
attribute
: attribute path (dispatch only)
Functions
#now
#random
#version
#platform
- Technology: android, ios, native (either iOS or Android), web
- Form factor: web, mobile, tablet
date(value)
Examples
(3 is 3) and (1 not 1 or 2 is 2)
test in [hey, ok, test]
user is admin
user is self
user is other
user program includes [handles]
user group includes [handles]
user label includes [handles]
user membership includes [strings]
user membership is string
user active program exists
user active program includes [handles]
profile.gender is 'female'
profile.age < 30
#platform is android
#platform is ios
#platform is web
#platform not web
#version > 3.0.100
#version >= 3.0.0
values.field is 'something'
#now < 16:00
#now < 2020-08-01
#random 1 / 2
date(values.date) is future
Usage notes
#random
allows rules that happen some time; for example #random 1/2
would be true 50% of the time
#version
enables the ability to hide functionality that won't work on older versions