FEEL Built-in Functions
FEEL comes with a standard library of functions that you call from FEEL expressions in DMN decisions and in BPMN conditions and mappings. This page lists every built-in function the engine provides: the parameters it takes, what it returns, and what it does at the edges, such as an empty list, a position past the end or a null argument. The extension functions at the end, such as is defined and from json, are not part of the DMN standard library.
Every example block opens in the FEEL playground, where each line runs as its own expression and the expected result stays visible as a comment. For recipes organised by task instead of by function, see the FEEL cheat sheet.
Reading the signatures
substring(string, start position, length?): string means that substring takes a string, a start position and an optional length, and returns a string. A ? marks an optional parameter.
The parameter names are the names the engine accepts for named arguments. Named arguments can come in any order, and a name with spaces is written as it is:
substring("foobar", 3, 2) // "ob"
substring(string: "foobar", start position: 3, length: 2) // "ob"
substring(length: 2, string: "foobar", start position: 3) // "ob"
Positions in strings and lists are 1-based. Where a function takes a position, a negative position counts from the end, so -1 is the last element.
Some list functions take their items either as one list or as separate arguments, for example sum([1, 2, 3]) and sum(1, 2, 3). Each entry says when that is the case.
Null arguments and errors
A function that receives null or a value of the wrong type cannot produce a result. What happens then depends on the error mode:
- Strict (the default) stops the evaluation with an error that names the function, for example
string length: argument cannot be null. - Lenient makes that call return
nulland reports the error as a warning. The rest of the expression keeps its value.
The examples on this page show strict results, so a call that fails is marked // error. Some functions handle null on purpose, and their entries say so: string(null) returns null, aggregates such as sum and min return null for an empty list or a list that contains null, and all, any and not use three-valued logic.
String functions
string()
string(from): string
Converts any value to its string form. Numbers keep their scale, so 1.50 becomes "1.50". Lists and contexts are written in FEEL literal syntax. string(null) is null, not the text "null".
FEEL never converts types on its own, so joining text and a number needs string().
string(123) // "123"
string(1.50) // "1.50"
string(true) // "true"
string(date("2026-10-24")) // "2026-10-24"
string(duration("PT90M")) // "PT1H30M"
string([1, 2]) // "[1, 2]"
string(null) // null
"Total: " + string(10) // "Total: 10"
"Total: " + 10 // error
string length()
string length(string): number
Returns the number of characters. Characters are Unicode code points, so an accented letter counts as one.
string length("foo") // 3
string length("") // 0
string length("Zürich") // 6
string length(123) // error
upper case()
upper case(string): string
Converts every letter to upper case.
upper case("hello World") // "HELLO WORLD"
upper case("qb-2026") // "QB-2026"
lower case()
lower case(string): string
Converts every letter to lower case. Comparisons in FEEL are case-sensitive, so lower-case both sides to compare without case.
lower case("HELLO World") // "hello world"
lower case("Ada@Example.com") = "ada@example.com" // true
substring()
substring(string, start position, length?): string
Returns length characters of string from start position, or the rest of the string when length is left out. Positions are 1-based and a negative start counts from the end. A start of 0 or past the end returns "" instead of an error, and a length past the end stops at the end.
substring("foobar", 3) // "obar"
substring("foobar", 3, 3) // "oba"
substring("foobar", -2) // "ar"
substring("foobar", -2, 1) // "a"
substring("foobar", 2, 100) // "oobar"
substring("foobar", 0) // ""
substring("foobar", 7) // ""
substring before()
substring before(string, match): string
Returns the part of string before the first occurrence of match, or "" when match does not occur. match is plain text, not a regular expression.
substring before("foobar", "bar") // "foo"
substring before("ada@example.com", "@") // "ada"
substring before("v1.2.3", ".") // "v1"
substring before("foobar", "xyz") // ""
substring after()
substring after(string, match): string
Returns the part of string after the first occurrence of match, or "" when match does not occur. match is plain text.
substring after("foobar", "ob") // "ar"
substring after("ada@example.com", "@") // "example.com"
substring after("foobar", "xyz") // ""
replace()
replace(input, pattern, replacement, flags?): string
Replaces every match of the regular expression pattern. In replacement, $1, $2 and so on insert the capture groups.
flags is a string of letters: i ignores case, s lets . match a newline, m makes ^ and $ match at line breaks, and x ignores whitespace in the pattern. A pattern that can match the empty string is an error.
Because pattern is a regular expression, . matches any character. Escape it as \. to match a dot.
replace("banana", "a", "o") // "bonono"
replace("2026-10-24", "(\d+)-(\d+)-(\d+)", "$3.$2.$1") // "24.10.2026"
replace("Abc", "a", "x", "i") // "xbc"
replace("a.b.c", "\.", "-") // "a-b-c"
replace("a.b.c", ".", "-") // "-----"
replace("abc", "", "x") // error
contains()
contains(string, match): boolean
True when match occurs anywhere in string. The comparison is case-sensitive and match is plain text. Every string contains "". To look for an element in a list, use list contains().
contains("foobar", "ob") // true
contains("foobar", "OB") // false
contains("foobar", "") // true
starts with()
starts with(string, match): boolean
True when string begins with match. match is plain text.
starts with("foobar", "fo") // true
starts with("QB-2026-001", "QB-") // true
starts with("foobar", "bar") // false
ends with()
ends with(string, match): boolean
True when string ends with match. match is plain text, so a dot needs no escaping.
ends with("foobar", "bar") // true
ends with("invoice.pdf", ".pdf") // true
ends with("foobar", "foo") // false
string join()
string join(list, delimiter?, prefix?, suffix?): string
Joins a list of strings. null items are skipped and any other item that is not a string is an error. Without a delimiter the items are joined directly. prefix and suffix wrap the whole result. To join numbers, convert them with string() first.
string join(["a", "b", "c"], ", ") // "a, b, c"
string join(["a", "b", "c"]) // "abc"
string join(["a", null, "c"], "-") // "a-c"
string join(["a", "b"], ", ", "[", "]") // "[a, b]"
string join([], ", ") // ""
string join([1, 2], ", ") // error
string join(for n in [1, 2] return string(n), ", ") // "1, 2"
split()
split(string, delimiter): list<string>
Splits string at every match of the regular expression delimiter. Empty parts are kept. Because delimiter is a regular expression, "." matches every character, so escape it as "\.".
split("a,b,c", ",") // ["a", "b", "c"]
split("a , b,c", "\s*,\s*") // ["a", "b", "c"]
split("a;b;;c", ";") // ["a", "b", "", "c"]
split("v1.2.3", "\.") // ["v1", "2", "3"]
split("a.b", ".") // ["", "", "", ""]
matches()
matches(input, pattern, flags?): boolean
True when the regular expression pattern matches anywhere in input. Anchor it with ^ and $ to test the whole string. The flags are the same as for replace(). An invalid pattern is an error.
matches("foobar", "bar") // true
matches("foobar", "^bar") // false
matches("QB-2026-001", "^QB-\d{4}-\d{3}$") // true
matches("FooBar", "foobar", "i") // true
matches("abc", "[") // error
Number functions
FEEL numbers are decimals, not binary floating point. 0.1 + 0.2 is exactly 0.3, and the rounding functions below work on the decimal digits you see.
0.1 + 0.2 = 0.3 // true
The rounding functions differ in where a value goes, and in what they do with a tie such as 2.5:
| Function | 2.5 | -2.5 | 1.125 to 2 places |
|---|---|---|---|
round up (away from zero) | 3 | -3 | 1.13 |
round down (toward zero) | 2 | -2 | 1.12 |
round half up (tie away from zero) | 3 | -3 | 1.13 |
round half down (tie toward zero) | 2 | -2 | 1.12 |
decimal (tie to even) | 2 | -2 | 1.12 |
ceiling (toward positive) | 3 | -2 | 1.13 |
floor (toward negative) | 2 | -3 | 1.12 |
abs()
abs(n): number
Returns the absolute value. It also works on durations.
abs(-10) // 10
abs(-1.5) // 1.5
abs(duration("-PT1H")) // duration("PT1H")
ceiling()
ceiling(n, scale?): number
Rounds toward positive infinity, to an integer or to scale decimal places.
ceiling(1.4) // 2
ceiling(-1.4) // -1
ceiling(1.234, 2) // 1.24
floor()
floor(n, scale?): number
Rounds toward negative infinity, to an integer or to scale decimal places.
floor(1.6) // 1
floor(-1.6) // -2
floor(1.236, 2) // 1.23
round up()
round up(n, scale): number
Rounds away from zero to scale decimal places. scale is required, so use 0 for an integer.
round up(5.5, 0) // 6
round up(-5.5, 0) // -6
round up(1.121, 2) // 1.13
round down()
round down(n, scale): number
Rounds toward zero to scale decimal places, which drops the extra digits.
round down(5.5, 0) // 5
round down(-5.5, 0) // -5
round down(1.129, 2) // 1.12
round half up()
round half up(n, scale): number
Rounds to the nearest value. A tie goes away from zero.
round half up(5.5, 0) // 6
round half up(-5.5, 0) // -6
round half up(1.125, 2) // 1.13
round half up(1.124, 2) // 1.12
round half down()
round half down(n, scale): number
Rounds to the nearest value. A tie goes toward zero.
round half down(5.5, 0) // 5
round half down(-5.5, 0) // -5
round half down(1.125, 2) // 1.12
round half down(1.126, 2) // 1.13
decimal()
decimal(n, scale): number
Rounds to scale decimal places. A tie goes to the even neighbor (banker's rounding), so ties do not all round in the same direction.
decimal(1/3, 2) // 0.33
decimal(1.5, 0) // 2
decimal(2.5, 0) // 2
decimal(1.125, 2) // 1.12
decimal(1.135, 2) // 1.14
modulo()
modulo(dividend, divisor): number
Returns the remainder of the division. The result has the sign of the divisor. A divisor of 0 is an error.
modulo(10, 3) // 1
modulo(-10, 3) // 2
modulo(10, -3) // -2
modulo(10.5, 3) // 1.5
modulo(10, 0) // error
sqrt()
sqrt(number): number
Returns the square root. A negative number is an error.
sqrt(16) // 4
sqrt(2.25) // 1.5
sqrt(-1) // error
exp()
exp(number): number
Returns e raised to the power of number.
exp(0) // 1
decimal(exp(1), 4) // 2.7183
log()
log(number): number
Returns the natural logarithm. Zero or a negative number is an error. For a base 10 logarithm, divide by log(10).
log(1) // 0
decimal(log(10), 4) // 2.3026
decimal(log(1000) / log(10), 4) // 3
log(0) // error
even()
even(number): boolean
True when number is an even integer. A number with a fractional part is an error.
even(4) // true
even(5) // false
even(-2) // true
even(1.5) // error
odd()
odd(number): boolean
True when number is an odd integer. A number with a fractional part is an error.
odd(3) // true
odd(0) // false
odd(1.5) // error
number()
number(from, grouping separator?, decimal separator?): number
Parses a string into a number. Pass the separators to read formatted input. Without them the string must be a plain number, so "1,000" is an error.
number("12.5") // 12.5
number("1,000.50", ",", ".") // 1000.50
number("1.000,50", ".", ",") // 1000.50
number("1 000,50", " ", ",") // 1000.50
number("1,000") // error
number("abc") // error
Boolean functions
not()
not(negand): boolean
Negates a boolean. not(null) is null, and any value that is not a boolean is an error. The argument is passed by position only.
not(true) // false
not(5 > 3) // false
not(null) // null
not(5) // error
is()
is(value1, value2): boolean
True when both arguments are the same value of the same type. A date and a date and time are never the same, and a year-based duration is not the same as a day-based one. A time or date and time without a time zone is never the same as one with a zone, even at the same clock reading. To test the type of a single value, use instance of.
is(5, 5) // true
is(5, "5") // false
is(date("2026-01-01"), date and time("2026-01-01T00:00:00")) // false
is(duration("P1Y"), duration("P12M")) // true
is(duration("P1Y"), duration("P365D")) // false
is(time("23:00:50Z"), time("23:00:50+00:00")) // true
is(date and time("2026-01-01T00:00:00"), date and time("2026-01-01T00:00:00Z")) // false
5 instance of number // true
List functions
Positions in a list are 1-based and a negative position counts from the end. A position outside the list is an error. To pick elements by a condition instead of a position, use a filter such as items[item.price > 100], described in the syntax guide.
list contains()
list contains(list, element): boolean
True when the list has an element equal to element. Lists and contexts compare by value, and null can be searched for. Types are not converted, so "1" does not match 1. For a single value, x in list gives the same answer.
list contains([1, 2, 3], 2) // true
list contains([[1, 2]], [1, 2]) // true
list contains([1, null], null) // true
list contains([1, 2], "1") // false
2 in [1, 2, 3] // true
count()
count(list): number
Returns the number of elements, null elements included. A nested list counts as one element.
count([1, 2, 3]) // 3
count([]) // 0
count([null, null]) // 2
count([[1, 2], [3]]) // 2
min()
min(list): any
Returns the smallest element. The items can also be passed as separate arguments. It works on any values that compare with <: numbers, strings, dates and durations. An empty list or a null element gives null, so filter out null first when it can occur.
min([3, 1, 2]) // 1
min(3, 1, 2) // 1
min(["pear", "apple"]) // "apple"
min([date("2026-03-01"), date("2026-01-15")]) // date("2026-01-15")
min([]) // null
min([1, null, 3]) // null
min([1, null, 3][item != null]) // 1
max()
max(list): any
Returns the largest element. The items can also be passed as separate arguments. It behaves like min() for types, empty lists and null.
max([1, 2, 3]) // 3
max(1, 2, 3) // 3
max([duration("PT1H"), duration("PT30M")]) // duration("PT1H")
max([]) // null
sum()
sum(list): number
Adds up a list of numbers. The items can also be passed as separate arguments. An empty list or a null element gives null. Use if count(xs) = 0 then 0 else sum(xs) when an empty list should total zero. To total a field of a list of contexts, select the field with a path.
sum([1, 2, 3]) // 6
sum(1, 2, 3) // 6
sum([0.1, 0.2]) // 0.3
sum([{price: 10}, {price: 5}].price) // 15
sum([]) // null
sum([1, null]) // null
product()
product(list): number
Multiplies a list of numbers. The items can also be passed as separate arguments. An empty list is an error.
product([2, 3, 4]) // 24
product(2, 3, 4) // 24
product([]) // error
mean()
mean(list): number
Returns the arithmetic mean of a list of numbers. The items can also be passed as separate arguments. An empty list gives null.
mean([1, 2, 3]) // 2
mean([1, 2]) // 1.5
mean([]) // null
median()
median(list): number
Returns the middle value of the sorted numbers, or the mean of the two middle values when the count is even. The items can also be passed as separate arguments. An empty list gives null.
median([8, 2, 5, 3, 4]) // 4
median([6, 1, 2, 3]) // 2.5
median([]) // null
stddev()
stddev(list): number
Returns the sample standard deviation, which divides by the count minus one. The items can also be passed as separate arguments. It needs at least two numbers.
decimal(stddev([2, 4, 7, 5]), 4) // 2.0817
decimal(stddev(1, 3), 4) // 1.4142
stddev([1]) // error
mode()
mode(list): list<number>
Returns the most frequent numbers as a sorted list. A tie returns all of them, and an empty list returns []. The items can also be passed as separate arguments.
mode([6, 3, 9, 6, 6]) // [6]
mode([6, 1, 9, 6, 1]) // [1, 6]
mode([]) // []
all()
all(list): boolean
True when every element is true, and true for an empty list. When no element is false but some are null, the result is null. An element that is not a boolean is an error. The items can also be passed as separate arguments. To test a condition on every element, every x in list satisfies condition is often shorter.
all([true, true]) // true
all([true, false]) // false
all([]) // true
all([true, null]) // null
all([false, null]) // false
any()
any(list): boolean
True when at least one element is true, and false for an empty list. When no element is true but some are null, the result is null. The items can also be passed as separate arguments. The quantified form is some x in list satisfies condition.
any([false, true]) // true
any([]) // false
any([false, null]) // null
any([true, null]) // true
sublist()
sublist(list, start position, length?): list
Returns length elements from start position, or the rest of the list when length is left out. A negative start counts from the end. A start position outside the list is an error.
sublist([4, 5, 6], 2) // [5, 6]
sublist([4, 5, 6], 1, 2) // [4, 5]
sublist([4, 5, 6], -1) // [6]
sublist([4, 5, 6], 5) // error
append()
append(list, item...): list
Returns the list with the items added at the end. A list passed as an item is added as one element, so use concatenate() to join lists. The arguments are passed by position only.
append([1], 2, 3) // [1, 2, 3]
append([1], [2, 3]) // [1, [2, 3]]
append([], null) // [null]
concatenate()
concatenate(list...): list
Joins lists into one, keeping duplicates. The arguments are passed by position only.
concatenate([1, 2], [3]) // [1, 2, 3]
concatenate([1], [2], [3, 4]) // [1, 2, 3, 4]
concatenate([1], [1]) // [1, 1]
insert before()
insert before(list, position, newItem): list
Inserts newItem before the element at position. A negative position counts from the end. To add at the end, use append().
insert before([1, 3], 2, 2) // [1, 2, 3]
insert before([1, 3], 1, 0) // [0, 1, 3]
insert before([1, 3], -1, 2) // [1, 2, 3]
insert before([1, 3], 3, 4) // error
remove()
remove(list, position): list
Removes the element at position. A negative position counts from the end. To remove elements by value, filter them out instead.
remove([1, 2, 3], 2) // [1, 3]
remove([1, 2, 3], -1) // [1, 2]
remove([1, 2, 3], 4) // error
[1, 2, 3, 2][item != 2] // [1, 3]
reverse()
reverse(list): list
Returns the elements in reverse order.
reverse([1, 2, 3]) // [3, 2, 1]
reverse([]) // []
index of()
index of(list, match): list<number>
Returns every position where match occurs, or [] when it does not occur.
index of([1, 2, 3, 2], 2) // [2, 4]
index of(["a", "b"], "c") // []
union()
union(list...): list
Joins lists and removes duplicates, keeping the first occurrence of each value. The arguments are passed by position only.
union([1, 2], [2, 3]) // [1, 2, 3]
union([1, 1], [2], [3, 1]) // [1, 2, 3]
distinct values()
distinct values(list): list
Removes duplicates and keeps the first occurrence of each value. Lists and contexts compare by value, and strings compare with case.
distinct values([1, 2, 3, 2, 1]) // [1, 2, 3]
distinct values(["a", "A", "a"]) // ["a", "A"]
distinct values([{a: 1}, {a: 1}]) // [{a: 1}]
flatten()
flatten(list): list
Replaces nested lists with their elements, at every depth.
flatten([[1, 2], [[3]], 4]) // [1, 2, 3, 4]
flatten([]) // []
sort()
sort(list, precedes): list
Sorts the list with a function that returns true when its first argument belongs before its second. precedes is required, there is no default order.
sort([3, 1, 4, 2], function(x, y) x < y) // [1, 2, 3, 4]
sort([3, 1, 4, 2], function(x, y) x > y) // [4, 3, 2, 1]
sort(["pear", "apple"], function(a, b) a < b) // ["apple", "pear"]
sort([{n: 2}, {n: 1}], function(a, b) a.n < b.n) // [{n: 1}, {n: 2}]
sort([3, 1]) // error
list replace()
list replace(list, position, newItem): list or list replace(list, match, newItem): list
With a position, replaces the element at that position. A negative position counts from the end. With a function match(item, newItem), replaces every element for which the function returns true.
list replace([2, 4, 7, 8], 3, 6) // [2, 4, 6, 8]
list replace([2, 4, 7, 8], -1, 0) // [2, 4, 7, 0]
list replace([2, 4, 7, 8], function(item, newItem) item < newItem, 5) // [5, 5, 7, 8]
list replace([1, 2], 5, 0) // error
Date and time functions
Dates, times, date-times and durations are typed values. Create them with the functions below or with an @ literal such as @"2026-10-24". Their parts are properties, for example date("2026-10-24").year, and arithmetic works across the types: a date minus a date is a duration, and a date plus a duration is a date.
@"2026-10-24" = date("2026-10-24") // true
date("2026-10-24").year // 2026
date("2026-10-24") - date("2026-01-01") // duration("P296D")
date and time("2026-10-24T10:00:00") + duration("PT90M") // date and time("2026-10-24T11:30:00")
date()
date(from): date or date(year, month, day): date
Creates a date from an ISO 8601 string (YYYY-MM-DD), from a date and time by dropping the time, or from its parts. A day that does not exist is an error, and no other string format is read. Reorder other formats with replace() first.
date("2026-10-24") // date("2026-10-24")
date(2026, 10, 24) // date("2026-10-24")
date(date and time("2026-10-24T10:30:00")) // date("2026-10-24")
date(replace("24.10.2026", "(\d+)\.(\d+)\.(\d+)", "$3-$2-$1")) // date("2026-10-24")
date("2026-02-30") // error
date("24.10.2026") // error
time()
time(from): time or time(hour, minute, second, offset?): time
Creates a time of day from a string, from a date and time, or from its parts. A time can carry a UTC offset or a time zone name. As a part, offset is a duration.
time("10:30:00") // time("10:30:00")
time("10:30:00+02:00") // time("10:30:00+02:00")
time("10:30:00@Europe/Bratislava") // time("10:30:00@Europe/Bratislava")
time(10, 30, 0) // time("10:30:00")
time(10, 30, 0, duration("PT2H")) // time("10:30:00+02:00")
time(date and time("2026-10-24T10:30:00")) // time("10:30:00")
time("25:00:00") // error
date and time()
date and time(from): date and time or date and time(date, time): date and time
Creates a date and time from an ISO 8601 string, or from a date and a time. A string with only a date gives midnight. Values with different offsets compare by the moment they describe.
date and time("2026-10-24") // date and time("2026-10-24T00:00:00")
date and time(date("2026-10-24"), time("10:30:00")) // date and time("2026-10-24T10:30:00")
date and time("2026-10-24T10:30:00@Europe/Bratislava").hour // 10
date and time("2026-10-24T10:30:00+02:00") = date and time("2026-10-24T08:30:00Z") // true
date and time(date, timezone): date and time is an extension: it returns the same instant in another time zone. timezone is a zone name such as "Europe/Berlin", "Z", or an offset such as "+01:00". A date and time without a zone is read as UTC.
date and time(@"2020-07-31T14:27:30@Europe/Berlin", "America/Los_Angeles") // @"2020-07-31T05:27:30@America/Los_Angeles"
date and time(@"2020-07-31T14:27:30", "Z") // @"2020-07-31T14:27:30Z"
date and time(date: @"2020-07-31T14:27:30Z", timezone: "+02:00") // @"2020-07-31T16:27:30+02:00"
date and time(@"2020-07-31T14:27:30Z", "Mars/Olympus") // error
duration()
duration(from): duration
Creates a duration from an ISO 8601 string. Day and time durations (P1DT2H30M) and year and month durations (P1Y2M) are separate kinds. A day and time duration is normalized, so PT90M reads as PT1H30M and P1W as P7D. Adding months to a date keeps the day of the month where it exists and uses the last day of the month where it does not.
duration("PT90M") // duration("PT1H30M")
duration("P1W") // duration("P7D")
duration("-PT1H") // duration("-PT1H")
duration("PT90M").hours // 1
date("2026-10-24") + duration("P1M") // date("2026-11-24")
date("2026-01-31") + duration("P1M") // date("2026-02-28")
duration("1 hour") // error
years and months duration()
years and months duration(from, to): duration
Returns the whole years and months between two dates or date-times. The result is negative when to is earlier than from. Its years property gives an age.
years and months duration(date("2024-01-15"), date("2026-10-24")) // duration("P2Y9M")
years and months duration(date("2026-10-24"), date("2024-01-15")) // duration("-P2Y9M")
years and months duration(date("1990-05-20"), date("2026-10-24")).years // 36
day of year()
day of year(date): number
Returns the day of the year, from 1 to 366. It accepts a date or a date and time.
day of year(date("2026-02-01")) // 32
day of year(date("2026-12-31")) // 365
day of year(date("2024-12-31")) // 366
day of week()
day of week(date): string
Returns the English name of the weekday. It accepts a date or a date and time.
day of week(date("2026-10-24")) // "Saturday"
day of week(date and time("2026-10-26T09:00:00")) // "Monday"
month of year()
month of year(date): string
Returns the English name of the month. It accepts a date or a date and time.
month of year(date("2026-10-24")) // "October"
week of year()
week of year(date): number
Returns the ISO 8601 week number. Weeks start on Monday, and week 1 is the week that contains the first Thursday of the year, so the first days of January can belong to the last week of the year before.
week of year(date("2026-10-24")) // 43
week of year(date("2026-01-01")) // 1
week of year(date("2021-01-03")) // 53
last day of month()
last day of month(date): date
Returns the last day of the month that date falls in, leap years included.
last day of month(date("2024-02-10")) // date("2024-02-29")
last day of month(date("2026-02-10")) // date("2026-02-28")
today()
today(): date
Returns the current date. A decision that calls it gives different results on different days, so pass the date in as an input when the result has to be repeatable or testable.
today() instance of date // true
now()
now(): date and time
Returns the current date and time. The same advice as for today() applies.
now() instance of date and time // true
Range functions
A range is written with two endpoints, such as [1..10]. A square bracket includes its endpoint and a round bracket excludes it, so (1..10] does not contain 1.
The functions below compare points and ranges. A point, and each endpoint of a range, can be a number, a string, a date, a time, a date and time or a duration. Both arguments must hold the same type, so before(1, "a") is an error. A range made by range() can leave one end open, and an open end lies beyond every value on that side.
5 in (1..10] // true
1 in (1..10] // false
date("2026-10-15") in [date("2026-10-01")..date("2026-10-31")] // true
before(@"2026-01-01", @"2026-01-02") // true
during(@"2026-05-01", [@"2026-01-01"..@"2026-12-31"]) // true
overlaps([@"2026-01-01"..@"2026-03-01"], [@"2026-02-01"..@"2026-04-01"]) // true
before(duration("PT1H"), duration("PT2H")) // true
before(1, "a") // error
range()
range(from): range
Parses a range from a string in bracket form, for example a range that arrives as input data. The endpoints are literals: numbers, strings, or dates, times and durations written as date("...") and the like. Leaving out one endpoint leaves that side open, as in "[2..)" or "(..2)". Other forms, such as ">= 5", are an error.
range("[1..10]") // [1..10]
range("(1..10)") // (1..10)
5 in range("[1..10]") // true
3 in range("[2..)") // true
2 in range("(..2)") // false
"c" in range("[\"a\"..\"m\"]") // true
date("2026-05-01") in range("[date(\"2026-01-01\")..date(\"2026-12-31\")]") // true
range(">= 5") // error
before()
before(point1, point2), before(point, range), before(range, point) or before(range1, range2), all returning boolean
True when the first argument ends before the second starts. Excluded endpoints count, so before(1, (1..5]) is true because 1 is not in the range.
before(1, 10) // true
before(1, [2..5]) // true
before(1, [1..5]) // false
before(1, (1..5]) // true
before([1..5], [6..10]) // true
before([1..5), [5..10]) // true
before([1..5], [5..10]) // false
after()
after(point1, point2), after(point, range), after(range, point) or after(range1, range2), all returning boolean
True when the first argument starts after the second ends.
after(10, 5) // true
after(12, [2..5]) // true
after([6..10], [1..5]) // true
after((5..10], [1..5]) // true
after([5..10], [1..5]) // false
meets()
meets(range1, range2): boolean
True when range1 ends exactly where range2 starts, and both ranges include that endpoint.
meets([1..5], [5..10]) // true
meets([1..5), [5..10]) // false
met by()
met by(range1, range2): boolean
True when range1 starts exactly where range2 ends, and both ranges include that endpoint.
met by([5..10], [1..5]) // true
met by([5..10], [1..5)) // false
overlaps()
overlaps(range1, range2): boolean
True when the ranges share at least one point.
overlaps([1..5], [3..8]) // true
overlaps([1..5], [5..8]) // true
overlaps([1..5), [5..8]) // false
overlaps([1..5], [6..8]) // false
overlaps before()
overlaps before(range1, range2): boolean
True when the ranges overlap, range1 starts first and range1 ends inside range2.
overlaps before([1..5], [3..8]) // true
overlaps before([3..8], [1..5]) // false
overlaps after()
overlaps after(range1, range2): boolean
True when the ranges overlap, range2 starts first and range2 ends inside range1.
overlaps after([3..8], [1..5]) // true
overlaps after([1..5], [3..8]) // false
finishes()
finishes(point, range) or finishes(range1, range2), returning boolean
True when the first argument ends where the range ends, and the range includes its end.
finishes(5, [1..5]) // true
finishes(5, [1..5)) // false
finishes([3..5], [1..5]) // true
finished by()
finished by(range, point) or finished by(range1, range2), returning boolean
True when the range ends where the second argument ends.
finished by([1..5], 5) // true
finished by([1..5], [3..5]) // true
finished by([1..5], 4) // false
includes()
includes(range, point) or includes(range1, range2), returning boolean
True when the range contains the point, or contains the whole second range.
includes([1..10], 5) // true
includes([1..10], [4..6]) // true
includes([1..10], 11) // false
includes((1..10], 1) // false
during()
during(point, range) or during(range1, range2), returning boolean
True when the first argument lies inside the range. It is includes() with the arguments swapped.
during(5, [1..10]) // true
during([4..6], [1..10]) // true
during(1, (1..10]) // false
starts()
starts(point, range) or starts(range1, range2), returning boolean
True when the first argument starts where the range starts, and the range includes its start.
starts(1, [1..5]) // true
starts([1..3], [1..5]) // true
starts(1, (1..5]) // false
started by()
started by(range, point) or started by(range1, range2), returning boolean
True when the range starts where the second argument starts.
started by([1..5], 1) // true
started by([1..5], [1..3]) // true
started by([1..5], 2) // false
coincides()
coincides(point1, point2) or coincides(range1, range2), returning boolean
True when both points are equal, or both ranges have the same endpoints with the same brackets.
coincides(5, 5) // true
coincides([1..5], [1..5]) // true
coincides([1..5], (1..5]) // false
Context functions
A context is the FEEL record type, written as {name: "Ada", tier: "gold"}. A path such as customer.tier reads a key that is known when you write the expression. The functions below cover keys that are only known at runtime, and building or changing a context.
get value()
get value(m, key): any
Returns the value stored under key, or null when there is none. key can also be a list of keys, which follows a nested path. A key with spaces is an ordinary string.
get value({a: 1}, "a") // 1
get value({a: 1}, "b") // null
get value({a: {b: 2}}, ["a", "b"]) // 2
get value({"first name": "Ada"}, "first name") // "Ada"
get entries()
get entries(m): list<context>
Returns the entries as a list of {key, value} contexts, sorted by key. Combine it with for to loop over a context.
get entries({b: 2, a: 1}) // [{key: "a", value: 1}, {key: "b", value: 2}]
get entries({}) // []
for e in get entries({x: 1, y: 2}) return e.key // ["x", "y"]
context()
context(entries): context
Builds a context from a list of {key, value} contexts, the reverse of get entries(). Every entry needs a key and a value, and a duplicate key is an error. It is the way to build a context whose keys are computed.
context([{key: "a", value: 1}, {key: "b", value: 2}]) // {a: 1, b: 2}
context(for k in ["x", "y"] return {key: k, value: 0}) // {x: 0, y: 0}
context([]) // {}
context([{key: "a", value: 1}, {key: "a", value: 2}]) // error
context put()
context put(context, key, value): context
Returns a new context with key set to value, replacing any value already there. With a list of keys it sets a nested value and creates the levels that are missing. The original context does not change.
context put({a: 1}, "b", 2) // {a: 1, b: 2}
context put({a: 1}, "a", 2) // {a: 2}
context put({a: {b: 1}}, ["a", "c"], 2) // {a: {b: 1, c: 2}}
context put({}, ["a", "b"], 1) // {a: {b: 1}}
context merge()
context merge(contexts): context
Merges a list of contexts into one. A key in a later context replaces the same key in an earlier one. The merge is shallow, so a nested context is replaced as a whole and not merged.
context merge([{a: 1}, {b: 2}]) // {a: 1, b: 2}
context merge([{a: 1, b: 1}, {b: 2}]) // {a: 1, b: 2}
context merge([{a: {x: 1}}, {a: {y: 2}}]) // {a: {y: 2}}
Extension functions
These functions are not part of the DMN standard library. They follow the same rules as the standard functions: null arguments and errors behave the same way, and a list argument that is a single value counts as a list of that value. The exceptions are is defined and get or else, which treat a value that fails as missing. The time zone form of date and time is an extension too.
is defined()
is defined(value): boolean
True when the value exists and is not null. A missing context entry is false, and so is a name that is not in scope at all, where a null check such as coupon != null raises an error. A value that fails is false in both error modes. A failed assert, calling something that is not a function and exceeding the evaluation limits stay errors.
is defined(1) // true
is defined(null) // false
is defined({a: 1}.b) // false
is defined(coupon) // false
is defined(null[1]) // false
is defined({a: {b: 2}}.a.b) // true
get or else()
get or else(value, default): any
Returns value, or default when the value is null, names nothing in scope or fails, in both error modes. A failed assert, calling something that is not a function and exceeding the evaluation limits stay errors. default is only evaluated when it is used, and a failure there is an error as usual.
get or else("this", "default") // "this"
get or else(null, "default") // "default"
get or else(discount, 0) // 0
get or else(null, null) // null
get or else(null[1], 0) // 0
get or else(1 / 0, 0) // 0
assert()
assert(value, condition, cause?): any
Returns value when condition is true, and fails the evaluation otherwise, with cause as the message when it is given. A failed assertion stays an error in lenient mode, where most errors become null.
assert(4, 4 >= 0) // 4
assert(-1, -1 >= 0) // error
assert(-1, -1 >= 0, "amount must not be negative") // error
from json()
from json(value): any
Parses a JSON text. Objects become contexts, arrays become lists, and numbers keep their exact decimal value. A JSON string stays a string even when it looks like a date: convert it with date() when you need one. Invalid JSON, or anything after the first value, is an error.
from json("{\"a\": 1, \"b\": [true, null]}") // {a: 1, b: [true, null]}
from json("\"2023-06-14\"") // "2023-06-14"
from json("0.1") + 0.2 // 0.3
from json("{bad") // error
to json()
to json(value): string
Writes a value as compact JSON. Contexts become objects and lists become arrays. Dates, times, date-times and durations become strings in their FEEL form.
to json({a: 1, b: "x"}) // "{\"a\":1,\"b\":\"x\"}"
to json([1, 2.50]) // "[1,2.50]"
to json(@"2023-06-14") // "\"2023-06-14\""
to json(@"P3Y") // "\"P3Y\""
to json(null) // "null"
is blank()
is blank(string): boolean
True when the string is empty or holds only whitespace.
is blank("") // true
is blank(" ") // true
is blank("hello") // false
trim()
trim(string): string
Removes leading and trailing whitespace. Whitespace between words stays.
trim(" hello world ") // "hello world"
trim("hello world ") // "hello world"
extract()
extract(string, pattern): list<string>
Returns every match of the regular expression pattern in string, or [] when nothing matches. The pattern follows the same rules as replace(), so a pattern that matches the empty string is an error.
extract("references are 1234, 1256, 1378", "12[0-9]*") // ["1234", "1256"]
extract("abc", "x") // []
extract("abc", "x*") // error
to base64()
to base64(value): string
Encodes the string as Base64.
to base64("FEEL") // "RkVFTA=="
from base64()
from base64(value): string
Decodes a Base64 string to text. Input that is not Base64, or that does not decode to UTF-8 text, is an error.
from base64("RkVFTA==") // "FEEL"
from base64("%%%") // error
is empty()
is empty(list): boolean
True when the list has no elements.
is empty([]) // true
is empty([1, 2, 3]) // false
duplicate values()
duplicate values(list): list
Returns each value that occurs more than once, once, in the order it first appears. Lists and contexts compare by value. distinct values() does the opposite.
duplicate values([1, 2, 3, 2, 1]) // [1, 2]
duplicate values([{a: 1}, {a: 1}, {a: 2}]) // [{a: 1}]
duplicate values(["a", "b"]) // []
partition()
partition(list, size): list<list>
Splits the list into consecutive sublists of size elements. The last sublist holds what is left. size must be a positive integer.
partition([1, 2, 3, 4, 5], 2) // [[1, 2], [3, 4], [5]]
partition([], 2) // []
partition([1, 2], 0) // error
Related
- FEEL cheat sheet - common tasks with runnable examples on one sample order.
- FEEL syntax - data types, operators, filters and the error modes.
- FEEL overview - what FEEL is and where it runs across DMN and BPMN.
- Tooling - autocomplete, validation and hover docs for these functions in the editor.