FEEL Basic types, operators and statements
Basic Types
Name | Description | Example |
---|---|---|
Boolean |
two possible values true or false. |
true false |
String |
plain text written in "quotes" or italics. |
"Trisotech" Trisotech |
Number |
numerical value. |
1000 5.1 |
Date |
YYYY-MM-DD format written in bold italic or as a function parameter string. |
2017-11-27 date("2017-11-27") |
Time |
HH:MM:SS format written in bold italic or as a function parameter string. |
09:12:00 time("09:12:00") |
Date and Time |
YYYY-MM-DDTHH:MM:SS format written in bold italic or as a function paramater string . |
2017-11-27T09:12:00 date and time("2017-11-27T09:12:00") |
Duration |
P[n]Y[n]M[n]DT[n]H[n]M[n]S format where [n] is a number written in bold italic or as a function parameter string. |
PT25M is 25 minutes duration("PT15M") is 15 minutes P1D is 1 day duration("P3M") is 3 months |
Null |
no other valid value. |
null |
[n1, n2, n3] |
a list of values. |
[1,3,7,1] is a list of 4 numbers ["Triso", "tech"] is a list of 2 strings |
Logical Operators
Name | Description | Example | Returned value |
---|---|---|---|
= |
equality |
duration("P1Y2M").months = 2 "triso" = "tech" |
true false |
!= |
not equality |
"triso" != "tech" 2 != 2 |
true false |
> |
greater than: strict numerical order if numbers or dates, strict alphabetical order if strings |
3 > 1 "a" > "f" invoice.date > date("2017-11-27") |
true false may be true or false |
>= |
greater or equal: numerical order if numbers or dates, alphabetical order if strings. |
6 / 2 >= 3 PT25M >= P1D invoice.number >= 52416 |
true false may be true or false |
< |
smaller than: strict numerical order if numbers or dates, strict alphabetical order if strings |
1 < 3 date("2018-11-27") < date("2017-11-27") customer.age < 65 |
true false may be true or false |
⇐ |
smaller or equal: numerical order if numbers or dates, alphabetical order if strings. |
PT25M ⇐ P1D 14 ⇐ 2 * 3 customer.age < 65 |
true false may be true or false |
and |
conjunction |
(2+2=4) and "a" < "b" true and false |
true false |
or |
disjunction |
duration("P1Y2M").months = 2 or (2*2=4) true or false |
true true |
not |
negation |
not(2=4) not(true) |
true false |
Arithmetic Operators
Name | Description | Example | Returned value |
---|---|---|---|
+ |
addition if numbers, concatenation if strings |
5 + 15 "Triso" + "tech" 2017-12-31 + P1D |
20 "Trisotech" 2018-01-01 |
- |
substraction |
10 - 2.5 date("2012-12-25") - date("2012-12-24") 2018-01-01T00:00:00 - PT1M |
7.5 P1D 2017-12-31T23:59 |
* |
multiplication |
0.2 * 100 7.5 * 2.3 3 * P1Y9M |
20 17.25 P5Y3M |
/ |
division |
1 / 500 P1DT5H / 4 -5 / 6 |
0.002 PT7H15M -0.8333333333333334 |
** |
exponential |
2 * * 3 1.7 * * 2 P10Y * * 2 |
8 2.89 null |
Extraction and filters:
Name | Description | Example | Returned value |
---|---|---|---|
. |
extracting by dot notation. |
duration("P1DT2H3M4S").minutes duration("P1Y2M").months |
3 2 |
… |
extracting at any depth using the descending operator. |
{ a: { b: 1} }…b |
[1] |
[n] |
selecting an element in a list, where n is a number. |
given mylist = [1,3,7,11] mylist[2] mylist[8] mylist[-1] |
3 null 11 |
[ex] |
filtering a list, where ex is an expression. |
[1,3,7,11][item > 5] |
[7,11] |
Intervals
Name | Description | Example | Returned value |
---|---|---|---|
in |
membership |
247 in [1,247,530] "a" in ["x","y","z"] |
true false |
[x..y] |
closed inclusive interval between x and y where both x and y are in the interval. |
11 in [1..11] 12 in [1..11] "c" in ["a" .."g"] |
true false true |
(x..y) |
open exclusive interval between x and y where both x and y are not in the interval. |
5 in (1..11) 1 in (1..11) "abc" in ("aba".."abz") |
true false true |
[x..y) |
interval between x and y where y is not in the interval. |
23 in [23..161) 247 in [35..247) "dmn" in ["bpmn".."cmmn") |
true false false |
(x..y] |
interval between x and y where x is not in the interval. |
161 in (23..161] 23 in (23..161] |
true false |
Statements
Name | Description | Example | Returned value |
---|---|---|---|
some in satisfies |
some i in [1,2,3,4] satisfies i > 3 some name in ["DMN", "BPMN", "CMMN"] satisfies string length(name) = 3 |
true true |
|
every in satisfies |
every name in ["DMN", "BPMN", "CMMN"] satisfies ends with(name,"MN") every name in ["DMN", "BPMN", "CMMN"] satisfies starts with(name,"D") every i in [1,2,3] satisfies i ⇐ 3 |
true false true |
|
if then else |
if client.age > 18 then "Accepted" else "Refused" |
||
for in return |
iterate over a list. |
for i in [1,2,3,4] return i*i for x in ["DMN","BPMN","CMMN"] return substring before(x,"MN") for num in 1..7 return if (num =1 or num =2) then 1 else (partial[-2] + partial[-1]) |
[1,4,9,16] ["D","CP","CM"] [1,1,2,3,5,8,13] |
between x and y |
membership. |
5 between 1 and 100 5 between 1 and 10 = (5 >= 1 and 5 ⇐ 10) "g" between "a" and "z" |
true true true |