The Camunda DMN engine supports FEEL for input entries. The FEEL term forexpression in input entires is simple unary tests. These simple unary teststest an input value against an expression and return either true
if the testis satisfied or false
otherwise. The expression can contain differentelements which are described in this sections.
Comparison
FEEL simple unary tests support the following comparison operators. Pleasenote that the equals operator is empty and not =
. Also, a non equal operator such as !=
does not exist. To express this, negation has to be used.
Name | Operator | Example | Description |
---|---|---|---|
Equal |
|
"Steak" |
Test that the input value is equal to the given value. |
Less | < |
< 10 |
Test that the input value is less than the given value. |
Less or Equal | <= |
<= 10 |
Test that the input value is less than or equal to the given value. |
Greater | > |
> 10 |
Test that the input value is greater than the given value. |
Greater or Equal | >= |
>= 10 |
Test that the input value is greater than or equal to the given value. |
Range
Some FEEL data types, such as numeric types and date types, can be tested againsta range of values. These ranges consist of a start value and an end value. Therange specifies if the start and end value is included in the range.
Start | End | Example | Description |
---|---|---|---|
include | include | [1..10] |
Test that the input value is greater than or equal to the start value and less than or equal to the end value. |
exclude | include | ]1..10] or (1..10] |
Test that the input value is greater than the start value and less than or equal to the end value. |
include | exclude | [1..10[ or [1..10) |
Test that the input value is greater than or equal to the start value and less than the end value. |
exclude | exclude | ]1..10[ or (1..10) |
Test that the input value is greater than the start value and less than the end value. |
Disjunction
A FEEL simple unary test can be specified as conjunction of expressions. Theseexpressions have to either have comparisons or ranges. The test is true
ifat least one of conjunct expressions is true
.
Examples:
- 3,5,7: Test if the input is either 3, 5 or 7
- <2,>10: Test if the input is either less than 2 or greater than 10
- 10,[20..30]: Test if the input is either 10 or between 20 and 30
- "Spareribs","Steak","Stew": Test if the input is either the StringSpareribs, Steak or Stew
- date and time("2015-11-30T12:00:00"),date and time("2015-12-01T12:00:00")]:Test if the input is either the date November 30th, 2015 at 12:00:00 o’clock orDecember 1st, 2015 at 12:00:00 o’clock
- >customer.age,>21: Test if the input is either greater than the ageproperty of the variable customer or greater than 21
Negation
A FEEL simple unary test can be negated with the not
function. This means ifthe containing expression returns true
, the test will return false
. Pleasenote that only one negation as first operator is allowed but it can containa disjunction.
Examples:
- not("Steak"): Test if the input is not the String Steak
- not(>10): Test if the input is not greater than 10, which means it is lessthan or equal to 10
- not(3,5,7): Test if the input is neither 3, 5 nor 7
- not([20..30]): Test if the input is not between 20 and 30
Qualified Names
FEEL simple unary tests can access variables and object properties byqualified names.
Examples:
- x: Test if the input is equal to the variable x
- >= x: Test if the input is greater than or equal to the variable x
- < customer.age: Test if the input is less than the age property of thevariable customer
Date Functions
FEEL simple unary tests provide functions to create date types. The CamundaDMN engine supports the following date functions:
date and time("…"): Creates a date and time value from a String with theformat yyyy-MM-dd'T'HHss
Examples:date and time("2015-11-30T12:00:00"): Test if the input is the dateNovember 30th, 2015 at 12:00:00 o’clock
- [date and time("2015-11-30T12:00:00")..date and
time("2015-12-01T12:00:00")]: Test if the input is between the dateNovember 30th, 2015 at 12:00:00 o’clock and December 1st, 2015 at 12:00:00o’clock
原文: https://docs.camunda.org/manual/7.9/reference/dmn11/feel/language-elements/