Skip to main content

Built-in Functions

The engine supports a wide range of standard FEEL functions.

String Functions

FunctionParametersReturn TypeDescriptionExample
stringfrom: anystringConverts a value to a string representation.string(123) = "123"
string lengthstring: stringnumberReturns the length of a string (number of characters).string length("foo") = 3
upper casestring: stringstringConverts a string to uppercase.upper case("hello") = "HELLO"
lower casestring: stringstringConverts a string to lowercase.lower case("HELLO") = "hello"
substringstring: string, start: number, length?: numberstringReturns a substring starting at the given position.substring("hello", 2, 3) = "ell"
substring beforestring: string, match: stringstringReturns the substring before the first occurrence of match.substring before("hello world", " ") = "hello"
substring afterstring: string, match: stringstringReturns the substring after the first occurrence of match.substring after("hello world", " ") = "world"
replaceinput: string, pattern: string, replacement: string, flags?: stringstringReplaces occurrences of a pattern with a replacement string (supports regex).replace("hello", "l", "L") = "heLLo"
containsstring: string, match: stringbooleanReturns true if the string contains the match substring.contains("hello", "ell") = true
starts withstring: string, match: stringbooleanReturns true if the string starts with the match substring.starts with("hello", "he") = true
ends withstring: string, match: stringbooleanReturns true if the string ends with the match substring.ends with("hello", "lo") = true
string joinlist: list<string>, delimiter?: string, prefix?: string, suffix?: stringstringJoins a list of strings with a delimiter.string join(["a","b","c"], ",") = "a,b,c"
splitstring: string, delimiter: stringlist<string>Splits a string using a delimiter (regex pattern).split("a,b,c", ",") = ["a","b","c"]
matchesinput: string, pattern: string, flags?: stringbooleanReturns true if the input matches the regex pattern.matches("hello", "h.*o") = true

Number Functions

FunctionParametersReturn TypeDescriptionExample
absnumber: numbernumberReturns the absolute value of a number.abs(-10) = 10
ceilingn: number, scale?: numbernumberRounds up to the nearest integer or specified scale.ceiling(1.4) = 2
floorn: number, scale?: numbernumberRounds down to the nearest integer or specified scale.floor(1.6) = 1
round upn: number, scale: numbernumberRounds up to the specified number of decimal places.round up(1.234, 2) = 1.24
round downn: number, scale: numbernumberRounds down to the specified number of decimal places.round down(1.236, 2) = 1.23
round half upn: number, scale: numbernumberRounds to the nearest value, rounding up on .5.round half up(1.25, 1) = 1.3
round half downn: number, scale: numbernumberRounds to the nearest value, rounding down on .5.round half down(1.25, 1) = 1.2
decimaln: number, scale: numbernumberReturns the decimal representation with the specified scale.decimal(1.5, 2) = 1.50
modulodividend: number, divisor: numbernumberReturns the remainder of division.modulo(10, 3) = 1
sqrtnumber: numbernumberReturns the square root of a number.sqrt(16) = 4
expnumber: numbernumberReturns e raised to the power of the number.exp(1) ≈ 2.718
lognumber: numbernumberReturns the natural logarithm of a number.log(10) ≈ 2.303
evennumber: numberbooleanReturns true if the number is even.even(4) = true
oddnumber: numberbooleanReturns true if the number is odd.odd(3) = true

List Functions

FunctionParametersReturn TypeDescriptionExample
list containslist: list, element: anybooleanReturns true if the list contains the element.list contains([1,2,3], 2) = true
countlist: listnumberReturns the number of elements in a list.count([1,2,3]) = 3
minlist: list<number>numberReturns the minimum value in a list.min([1,2,3]) = 1
maxlist: list<number>numberReturns the maximum value in a list.max([1,2,3]) = 3
sumlist: list<number>numberReturns the sum of all numbers in a list.sum([1,2,3]) = 6
productlist: list<number>numberReturns the product of all numbers in a list.product([2,3,4]) = 24
meanlist: list<number>numberReturns the arithmetic mean of a list of numbers.mean([1,2,3]) = 2
medianlist: list<number>numberReturns the median value of a list of numbers.median([1,2,3,4,5]) = 3
stddevlist: list<number>numberReturns the standard deviation of a list of numbers.stddev([2,4,7,5])
modelist: list<number>list<number>Returns the mode (most frequent values) of a list.mode([1,2,2,3]) = [2]
alllist: list<boolean>booleanReturns true if all elements in the list are true.all([true, true]) = true
anylist: list<boolean>booleanReturns true if any element in the list is true.any([false, true]) = true
sublistlist: list, start: number, length?: numberlistReturns a sublist starting at the given position.sublist([1,2,3,4], 2, 2) = [2,3]
appendlist: list, items...: anylistAppends items to a list.append([1,2], 3, 4) = [1,2,3,4]
concatenatelist: list, lists...: listlistConcatenates multiple lists.concatenate([1,2], [3,4]) = [1,2,3,4]
insert beforelist: list, position: number, newItem: anylistInserts an element before the specified position.insert before([1,3], 2, 2) = [1,2,3]
removelist: list, position: numberlistRemoves an element at the specified position.remove([1,2,3], 2) = [1,3]
reverselist: listlistReverses the order of elements in a list.reverse([1,2,3]) = [3,2,1]
index oflist: list, match: anylist<number>Returns a list of positions where the match is found.index of([1,2,3,2], 2) = [2,4]
unionlists...: listlistReturns the union of multiple lists (distinct values).union([1,2], [2,3]) = [1,2,3]
distinct valueslist: listlistReturns a list with duplicate values removed.distinct values([1,2,2,3]) = [1,2,3]
flattenlist: listlistFlattens nested lists into a single list.flatten([[1,2],[3,4]]) = [1,2,3,4]
sortlist: list, precedes?: functionlistSorts a list using natural order or a comparison function.sort([3,1,2]) = [1,2,3]
list replacelist: list, position: number, newItem: anylistReplaces an element at the specified position.list replace([1,2,3], 2, 5) = [1,5,3]

Date and Time Functions

FunctionParametersReturn TypeDescriptionExample
datefrom: stringdateCreates a date from a string or from year/month/day components.date("2023-01-15")
timefrom: stringtimeCreates a time from a string or from hour/minute/second components.time("10:30:00")
date and timefrom: stringdate and timeCreates a date-time from a string or from date and time components.date and time("2023-01-15T10:30:00")
durationfrom: stringdurationCreates a duration from a string (ISO 8601 format).duration("P1DT2H")
years and months durationfrom: stringyears and months durationCreates a year-month duration from a string or date parameters.years and months duration("P1Y2M")
day of yeardate: datenumberReturns the day of the year (1-366).day of year(date("2023-02-01"))
month of yeardate: datestringReturns the month name.month of year(date("2023-02-01")) = "February"
week of yeardate: datenumberReturns the week number of the year.week of year(date("2023-02-01"))
last day of monthdate: datedateReturns the last day of the month for a given date.last day of month(date("2023-02-01"))
today``dateReturns the current date.today()
now``date and timeReturns the current date and time.now()

Temporal Relation Functions

FunctionParametersReturn TypeDescriptionExample
beforepoint1: any, point2: anybooleanReturns true if point1 is before point2.before(date("2023-01-01"), date("2023-01-02")) = true
afterpoint1: any, point2: anybooleanReturns true if point1 is after point2.after(date("2023-01-02"), date("2023-01-01")) = true
meetsinterval1: range, interval2: rangebooleanReturns true if interval1 ends exactly when interval2 starts.meets([1..5], [5..10])
met byinterval1: range, interval2: rangebooleanReturns true if interval2 ends exactly when interval1 starts.met by([5..10], [1..5])
overlapsinterval1: range, interval2: rangebooleanReturns true if the intervals overlap.overlaps([1..5], [3..7])
overlaps beforeinterval1: range, interval2: rangebooleanReturns true if interval1 overlaps and ends before interval2 ends.overlaps before([1..5], [3..7])
overlaps afterinterval1: range, interval2: rangebooleanReturns true if interval1 overlaps and starts after interval2 starts.overlaps after([3..7], [1..5])
finishespoint: any, interval: rangebooleanReturns true if point/interval finishes at the end of interval.finishes(5, [1..5])
finished byinterval: range, point: anybooleanReturns true if interval is finished by point/interval.finished by([1..5], 5)
includesinterval: range, point: anybooleanReturns true if interval includes point/interval.includes([1..10], 5)
duringpoint: any, interval: rangebooleanReturns true if point/interval is during interval.during(5, [1..10])
startspoint: any, interval: rangebooleanReturns true if point/interval starts at the start of interval.starts(1, [1..5])
started byinterval: range, point: anybooleanReturns true if interval is started by point/interval.started by([1..5], 1)
coincidespoint1: any, point2: anybooleanReturns true if two points/intervals coincide.coincides([1..5], [1..5])

Context Functions

FunctionParametersReturn TypeDescriptionExample
get valuecontext: context, key: stringanyGets a value from a context by key.get value({a: 1}, "a") = 1
get entriescontext: contextlist<context>Returns a list of key-value pairs from a context.get entries({a: 1, b: 2})
contextentries: listcontextCreates a context from a list of key-value pairs.context([{key: "a", value: 1}])
context putcontext: context, key: string, value: anycontextAdds or updates a key-value pair in a context.context put({a: 1}, "b", 2)
context mergecontexts: list<context>contextMerges multiple contexts into one.context merge([{a: 1}, {b: 2}])

Other Functions

FunctionParametersReturn TypeDescriptionExample
isvalue: any, type: stringbooleanReturns true if value is of the specified type.is(5, "number") = true
rangefrom: stringrangeCreates a range from a string representation.range("[1..10]")
numberfrom: string, grouping separator?: string, decimal separator?: stringnumberConverts a string to a number with optional separators.number("1,000.50", ",", ".")