Extend your transaction monitoring rules with expression functions.
Expression functions allow you to extend your rule conditions enabling more precise transaction monitoring.
Below is a list of available expression functions, grouped by purpose. You can use these functions to build SumScript expressions.
NoteFor guidance on creating more complex conditions, see Advanced usage.
Array operations
Use these functions to perform operations on arrays.
arrayAvg
arrayAvgarrayAvg(array: NUMBER[]) → FLOAT NOT NULLReturns the arithmetic mean of the values in a numeric array.
Arguments
| Name | Type | Description |
|---|---|---|
array | NUMBER[] | Numeric array. |
Returns
| Type | Description |
|---|---|
FLOAT NOT NULL | Numeric result. |
arrayCount
arrayCountarrayCount(filter: (V) ->BOOL, array: V[]) → INT NOT NULLCounts the elements in an array that satisfy the predicate.
Arguments
| Name | Type | Description |
|---|---|---|
filter | (V) ->BOOL | Predicate applied to each element (returns true to count the element). |
array | V[] | Input array. |
Returns
| Type | Description |
|---|---|
INT NOT NULL | Resulting integer value. |
arrayFilter
arrayFilterarrayFilter(filter: (V) ->BOOL, array: V[]) → V[]Filters an array by applying the predicate function to each element.
Arguments
| Name | Type | Description |
|---|---|---|
filter | (V) ->BOOL | Predicate applied to each element (returns true to keep the element). |
array | V[] | Input array. |
Returns
| Type | Description |
|---|---|
V[] | Resulting array. |
arrayJoin
arrayJoinarrayJoin(source: V[]*) → V*Concatenates arrays/streams into a single stream.
Arguments
| Name | Type | Description |
|---|---|---|
source | V[]* | Arrays/streams to concatenate. |
Returns
| Type | Description |
|---|---|
V* | Result value. |
arrayMap
arrayMaparrayMap(fn: (V) ->R, array: V[]) → R[]Maps an array by applying the function to each element.
Arguments
| Name | Type | Description |
|---|---|---|
fn | (V) ->R | Mapping function applied to each element. |
array | V[] | Input array. |
Returns
| Type | Description |
|---|---|
R[] | Resulting array. |
arrayMax
arrayMaxarrayMax(array: V : COMPARABLE[]) → V : COMPARABLEReturns the maximum element of the array.
Arguments
| Name | Type | Description |
|---|---|---|
array | V : COMPARABLE\[] | Comparable array. |
Returns
| Type | Description |
|---|---|
V : COMPARABLE | Numeric result. |
arrayMin
arrayMinarrayMin(array: V : COMPARABLE[]) → V : COMPARABLEReturns the minimum element of the array.
Arguments
| Name | Type | Description |
|---|---|---|
array | V : COMPARABLE[] | Comparable array. |
Returns
| Type | Description |
|---|---|
V : COMPARABLE | Numeric result. |
arraySlice
arraySlicearraySlice(array: V[], offset: INT NOT NULL, length: INT) → V[]Returns a slice of an array starting at the given offset (and optional length).
Arguments
| Name | Type | Description |
|---|---|---|
array | V[] | Input array. |
offset | INT NOT NULL | Zero-based start index. |
length | INT | Maximum number of elements to return. |
Returns
| Type | Description |
|---|---|
V[] | Resulting array. |
arrayStddevSamp
arrayStddevSamparrayStddevSamp(array: NUMBER[]) → FLOAT NOT NULLReturns the sample standard deviation of the numeric array.
Arguments
| Name | Type | Description |
|---|---|---|
array | NUMBER[] | Numeric array. |
Returns
| Type | Description |
|---|---|
FLOAT NOT NULL | Numeric result. |
arraySum
arraySumarraySum(value: INT[]) → INT NOT NULLarraySum(value: FLOAT[]) → FLOAT NOT NULLReturns the sum of the numeric array.
Arguments
| Name | Type | Description |
|---|---|---|
value | INT[] | FLOAT[] | Numeric array. |
Returns
| Type | Description |
|---|---|
INT NOT NULL | FLOAT NOT NULL | Numeric result. |
countEqual
countEqualcountEqual(array: V[], value: V) → INT NOT NULLCounts how many elements in the array are equal to the given value.
Arguments
| Name | Type | Description |
|---|---|---|
array | V[] | Input array. |
value | V | Value to compare against. |
Returns
| Type | Description |
|---|---|
INT NOT NULL | Resulting integer value. |
empty
empty// Returns `true` if the string is null or empty.
empty(s: STRING) → BOOL NOT NULL// Returns `true` if the array is empty.
empty(array: V[]) → BOOL NOT NULLArguments
| Name | Type | Description |
|---|---|---|
s | array | STRING | V[] | Parameter. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
flatten
flattenflatten(array: V[][]) → V[]Flattens a 2D array into a 1D array.
Arguments
| Name | Type | Description |
|---|---|---|
array | V[][] | 2D array to flatten. |
Returns
| Type | Description |
|---|---|
V[] | Resulting array. |
has
hashas(array: V[], value: V) → BOOL NOT NULLReturns true if the array contains the given value.
Arguments
| Name | Type | Description |
|---|---|---|
array | V[] | Input array. |
value | V | Value to look for. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
hasAll
hasAllhasAll(array1: V[], array2: V[]) → BOOL NOT NULLReturns true if array1 contains all elements from array2.
Arguments
| Name | Type | Description |
|---|---|---|
array1 | V[] | First array. |
array2 | V[] | Second array. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
hasAny
hasAnyhasAny(array1: V[], array2: V[]) → BOOL NOT NULLReturns true if array1 and array2 have at least one common element.
Arguments
| Name | Type | Description |
|---|---|---|
array1 | V[] | First array. |
array2 | V[] | Second array. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
length
length// Returns the number of characters in a string.
length(s: STRING) → INT NOT NULL// Returns the number of elements in an array.
length(array: V[]) → INT NOT NULLArguments
| Name | Type | Description |
|---|---|---|
s | array | STRING | V[] | Parameter. |
Returns
| Type | Description |
|---|---|
INT NOT NULL | Resulting integer value. |
notEmpty
notEmpty// Returns `true` if the string is not null and not empty.
notEmpty(s: STRING) → BOOL NOT NULL// Returns `true` if the array is not empty.
notEmpty(array: V[]) → BOOL NOT NULLArguments
| Name | Type | Description |
|---|---|---|
s | array | STRING | V[] | Parameter. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
Client list operations
Use these functions to perform operations on Client lists.
allTokensInList
allTokensInListallTokensInList(clientList: CLIENT_LIST, value: STRING) → BOOL NOT NULLReturns true if all tokens of the input string are present in the list. Comparison is case-sensitive.
Arguments
| Name | Type | Description |
|---|---|---|
clientList | CLIENT_LIST | The client list to check against. |
value | STRING | Input string whose tokens are checked. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
allTokensInListIgnoreCase
allTokensInListIgnoreCaseallTokensInListIgnoreCase(clientList: CLIENT_LIST, value: STRING) → BOOL NOT NULL Returns true if all tokens of the input string are present in the list. Comparison is case-insensitive.
Arguments
| Name | Type | Description |
|---|---|---|
clientList | CLIENT_LIST | The client list to check against. |
value | STRING | Input string whose tokens are checked. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
anyTokenInList
anyTokenInListanyTokenInList(clientList: CLIENT_LIST, value: STRING) → BOOL NOT NULL Returns true if at least one token of the input string is present in the list. Comparison is case-sensitive.
Arguments
| Name | Type | Description |
|---|---|---|
clientList | CLIENT_LIST | The client list to check against. |
value | STRING | Input string whose tokens are checked. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
anyTokenInListIgnoreCase
anyTokenInListIgnoreCaseanyTokenInListIgnoreCase(clientList: CLIENT_LIST, value: STRING) → BOOL NOT NULL Returns true if at least one token of the input string is present in the list. Comparison is case-insensitive.
Arguments
| Name | Type | Description |
|---|---|---|
clientList | CLIENT_LIST | The client list to check against. |
value | STRING | Input string whose tokens are checked. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
inListIgnoreCase
inListIgnoreCaseinListIgnoreCase(clientList: CLIENT_LIST, value: STRING) → BOOL NOT NULL Returns true if the input string is present in the list. Comparison is case-insensitive. Unlike the token-based functions, the entire value is matched as-is against list entries without tokenization.
Arguments
| Name | Type | Description |
|---|---|---|
clientList | CLIENT_LIST | The client list to check against. |
value | STRING | Input string whose tokens are checked. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
anyKeyIsSubstringOf
anyKeyIsSubstringOf(value: STRING, clientList: CLIENT_LIST) → BOOL NOT NULLReturns true if any key from the list is a substring of value. Comparison is case-insensitive.
Arguments
| Name | Type | Description |
|---|---|---|
value | STRING | String to check against the client list's keys. |
clientList | CLIENT_LIST | The client list to check against. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
fuzzyMatchExactInList
fuzzyMatchExactInListfuzzyMatchExactInList(clientList: CLIENT_LIST, value: STRING) → BOOL NOT NULLReturns true if the normalized Levenshtein similarity between value and any entry of clientList is 1 (an exact match after normalization). Before comparison, value and every list entry are normalized: converted to lowercase, with all special characters and redundant whitespace removed.
Arguments
| Name | Type | Description |
|---|---|---|
clientList | CLIENT_LIST | The client list to check against. |
value | STRING | Input string fuzzy-matched against each list entry. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
fuzzyMatchStrictInList
fuzzyMatchStrictInListfuzzyMatchStrictInList(clientList: CLIENT_LIST, value: STRING) → BOOL NOT NULLReturns true if the normalized Levenshtein similarity between value and any entry of clientList is 0.9 or higher. Before comparison, value and every list entry are normalized: converted to lowercase, with all special characters and redundant whitespace removed.
Arguments
| Name | Type | Description |
|---|---|---|
clientList | CLIENT_LIST | The client list to check against. |
value | STRING | Input string fuzzy-matched against each list entry. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
fuzzyMatchDefaultInList
fuzzyMatchDefaultInListfuzzyMatchDefaultInList(clientList: CLIENT_LIST, value: STRING) → BOOL NOT NULLReturns true if the normalized Levenshtein similarity between value and any entry of clientList is 0.8 or higher. Before comparison, value and every list entry are normalized: converted to lowercase, with all special characters and redundant whitespace removed.
Arguments
| Name | Type | Description |
|---|---|---|
clientList | CLIENT_LIST | The client list to check against. |
value | STRING | Input string fuzzy-matched against each list entry. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
fuzzyMatchFuzzyInList
fuzzyMatchFuzzyInListfuzzyMatchFuzzyInList(clientList: CLIENT_LIST, value: STRING) → BOOL NOT NULLReturns true if the normalized Levenshtein similarity between value and any entry of clientList is 0.6 or higher. Before comparison, value and every list entry are normalized: converted to lowercase, with all special characters and redundant whitespace removed.
Arguments
| Name | Type | Description |
|---|---|---|
clientList | CLIENT_LIST | The client list to check against. |
value | STRING | Input string fuzzy-matched against each list entry. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
AttentionThe
fuzzyMatch*InListfunctions require additional configuration before use. If you want to use these functions, contact us to have them enabled for your account.
Date and time (basic operations)
Use these functions to perform basic date and time operations.
diffDays
diffDaysdiffDays(date1: DATE, date2: DATE) → INTReturns the difference between two dates in whole days.
Arguments
| Name | Type | Description |
|---|---|---|
date1 | DATE | Start date/time value. |
date2 | DATE | End date/time value. |
Returns
| Type | Description |
|---|---|
INT | Difference between two dates in days. |
diffHours
diffHoursdiffHours(date1: DATE, date2: DATE) → INTReturns the difference between two dates in whole hours.
Arguments
| Name | Type | Description |
|---|---|---|
date1 | DATE | Start date/time value. |
date2 | DATE | End date/time value. |
Returns
| Type | Description |
|---|---|
INT | Difference between two dates in hours. |
diffMinutes
diffMinutesdiffMinutes(date1: DATE, date2: DATE) → INTReturns the difference between two dates in whole minutes.
Arguments
| Name | Type | Description |
|---|---|---|
date1 | DATE | Start date/time value. |
date2 | DATE | End date/time value. |
Returns
| Type | Description |
|---|---|
INT | Difference between two dates in minutes. |
diffSeconds
diffSecondsdiffSeconds(date1: DATE, date2: DATE) → INTReturns the difference between two dates in whole seconds.
Arguments
| Name | Type | Description |
|---|---|---|
date1 | DATE | Start date/time value. |
date2 | DATE | End date/time value. |
Returns
| Type | Description |
|---|---|
INT | Difference between two dates in seconds. |
getTimeZone
getTimeZonegetTimeZone() → ZoneId NOT NULLReturns the engine's current time zone.
Returns
| Type | Description |
|---|---|
ZoneId NOT NULL | Time zone identifier. |
now
nownow() → DATE NOT NULLReturns the current date/time.
Returns
| Type | Description |
|---|---|
DATE NOT NULL | Result value. |
timeDiffMinutes
timeDiffMinutestimeDiffMinutes(a: DATE, b: DATE) → INTReturns the minimal cyclic difference between two times in minutes (wraps at 24h).
Arguments
| Name | Type | Description |
|---|---|---|
a | DATE | Parameter. |
b | DATE | Parameter. |
Returns
| Type | Description |
|---|---|
INT | Result value. |
timeDiffSeconds
timeDiffSecondstimeDiffSeconds(a: DATE, b: DATE) → INTReturns the minimal cyclic difference between two times in seconds (wraps at 24h).
Arguments
| Name | Type | Description |
|---|---|---|
a | DATE | Parameter. |
b | DATE | Parameter. |
Returns
| Type | Description |
|---|---|
INT | Result value. |
toDayOfWeek
toDayOfWeektoDayOfWeek(localDateTime: LOCAL_DATE_TIME) → INTReturns the ISO day-of-week number for the given local date/time (1=Monday..7=Sunday).
Arguments
| Name | Type | Description |
|---|---|---|
localDateTime | LOCAL_DATE_TIME | Input local date/time value. |
Returns
| Type | Description |
|---|---|
INT | Resulting integer value. |
toHour
toHourtoDayOfWeek(localDateTime: LOCAL_DATE_TIME) → INTExtracts the hour of day from a local date/time (0..23).
Arguments
| Name | Type | Description |
|---|---|---|
localDateTime | LOCAL_DATE_TIME | Input local date/time value. |
Returns
| Type | Description |
|---|---|
INT | Resulting integer value. |
toRelativeMinuteNum
toRelativeMinuteNumtoRelativeMinuteNum(date: DATE) → INTReturns the minute number within the day for the given date/time (0..1439).
Arguments
| Name | Type | Description |
|---|---|---|
date | DATE | Input date/time value. |
Returns
| Type | Description |
|---|---|
INT | Resulting integer value. |
toRelativeSecondNum
toRelativeSecondNumtoRelativeSecondNum(date: DATE) → INTReturns the second number within the day for the given date/time.
Arguments
| Name | Type | Description |
|---|---|---|
date | DATE | Input date/time value. |
Returns
| Type | Description |
|---|---|
INT | Resulting integer value. |
toTime
toTimetoTime(date: DATE) → DATEConverts the input date/time value to the engine's DATE type.
Arguments
| Name | Type | Description |
|---|---|---|
date | DATE | Parameter. |
Returns
| Type | Description |
|---|---|
DATE | Result value. |
Date and time (period boundaries)
Use these functions to perform date and time operations related to period boundaries.
startOfMonth
startOfMonthstartOfMonth(offset: INT NOT NULL) → DATE NOT NULLReturns the start of the month for the current date shifted by the given month offset.
Arguments
| Name | Type | Description |
|---|---|---|
offset | INT NOT NULL | Month offset relative to the current month (can be negative). |
Returns
| Type | Description |
|---|---|
DATE NOT NULL | A date/time value truncated/adjusted to the requested boundary. |
startOfYear
startOfYearstartOfYear(offset: INT NOT NULL) → DATE NOT NULLReturns the start of the year for the current date shifted by the given year offset.
Arguments
| Name | Type | Description |
|---|---|---|
offset | INT NOT NULL | Year offset relative to the current year (can be negative). |
Returns
| Type | Description |
|---|---|
DATE NOT NULL | A date/time value truncated/adjusted to the requested boundary. |
toLastDayOfMonth
toLastDayOfMonthtoLastDayOfMonth(date: V : DATE) → V : DATEReturns a date/time value moved to the last day of the month.
Arguments
| Name | Type | Description |
|---|---|---|
date | V : DATE | Input date/time value. |
Returns
| Type | Description |
|---|---|
V : DATE | A date/time value truncated/adjusted to the requested boundary. |
toStartOfDay
toStartOfDaytoStartOfDay(date: V : DATE) → V : DATETruncates a date/time value to the start of the day (00:00:00).
Arguments
| Name | Type | Description |
|---|---|---|
date | V : DATE | Input date/time value. |
Returns
| Type | Description |
|---|---|
V : DATE | A date/time value truncated/adjusted to the requested boundary. |
toStartOfHour
toStartOfHourtoStartOfHour(date: V : DATE) → V : DATETruncates a date/time value to the start of the hour (minutes/seconds set to zero).
Arguments
| Name | Type | Description |
|---|---|---|
date | V : DATE | Input date/time value. |
Returns
| Type | Description |
|---|---|
V : DATE | A date/time value truncated/adjusted to the requested boundary. |
toStartOfMonth
toStartOfMonthtoStartOfMonth(date: V : DATE) → V : DATETruncates a date/time value to the first day of the month (start of day).
Arguments
| Name | Type | Description |
|---|---|---|
date | V : DATE | Input date/time value. |
Returns
| Type | Description |
|---|---|
V : DATE | A date/time value truncated/adjusted to the requested boundary. |
toStartOfWeek
toStartOfWeektoStartOfWeek(date: V : DATE) → V : DATETruncates a date/time value to the start of the week.
Arguments
| Name | Type | Description |
|---|---|---|
date | V : DATE | Input date/time value. |
Returns
| Type | Description |
|---|---|
V : DATE | A date/time value truncated/adjusted to the requested boundary. |
toStartOfYear
toStartOfYeartoStartOfYear(date: V : DATE) → V : DATETruncates a date/time value to the first day of the year (start of day).
Arguments
| Name | Type | Description |
|---|---|---|
date | V : DATE | Input date/time value. |
Returns
| Type | Description |
|---|---|
V : DATE | A date/time value truncated/adjusted to the requested boundary. |
Date and time (relative offsets)
Use these functions to perform date and time operations with relative offsets.
days
daysdays(value: INT NOT NULL) → DURATION NOT NULLCreates a duration representing the given number of days.
Arguments
| Name | Type | Description |
|---|---|---|
value | INT NOT NULL | Amount of days. |
Returns
| Type | Description |
|---|---|
DURATION NOT NULL | A duration value. |
daysAgo
daysAgodaysAgo(value: INT NOT NULL) → DATE NOT NULLReturns the date/time that is the given number of days before now.
Arguments
| Name | Type | Description |
|---|---|---|
value | INT NOT NULL | Offset in days. |
Returns
| Type | Description |
|---|---|
DATE NOT NULL | A date/time value representing now minus the specified offset. |
hours
hourshours(value: INT NOT NULL) → DURATION NOT NULLCreates a duration representing the given number of hours.
Arguments
| Name | Type | Description |
|---|---|---|
value | INT NOT NULL | Amount of hours. |
Returns
| Type | Description |
|---|---|
DURATION NOT NULL | A duration value. |
hoursAgo
hoursAgohoursAgo(value: INT NOT NULL) → DATE NOT NULLReturns the date/time that is the given number of hours before now.
Arguments
| Name | Type | Description |
|---|---|---|
value | INT NOT NULL | Offset in hours. |
Returns
| Type | Description |
|---|---|
DATE NOT NULL | A date/time value representing now minus the specified offset. |
minutes
minutesminutes(value: INT NOT NULL) → DURATION NOT NULLCreates a duration representing the given number of minutes.
Arguments
| Name | Type | Description |
|---|---|---|
value | INT NOT NULL | Amount of minutes. |
Returns
| Type | Description |
|---|---|
DURATION NOT NULL | Duration value. |
minutesAgo
minutesAgominutesAgo(value: INT NOT NULL) → DATE NOT NULLReturns the date/time that is the given number of minutes before now.
Arguments
| Name | Type | Description |
|---|---|---|
value | INT NOT NULL | Offset in minutes. |
Returns
| Type | Description |
|---|---|
DATE NOT NULL | A date/time value representing now minus the specified offset. |
monthsAgo
monthsAgomonthsAgo(value: INT NOT NULL) → DATE NOT NULLReturns the date/time that is the given number of months before now.
Arguments
| Name | Type | Description |
|---|---|---|
value | INT NOT NULL | Offset in months. |
Returns
| Type | Description |
|---|---|
DATE NOT NULL | A date/time value representing now minus the specified offset. |
seconds
secondsseconds(value: INT NOT NULL) → DURATION NOT NULLCreates a duration representing the given number of seconds.
Arguments
| Name | Type | Description |
|---|---|---|
value | INT NOT NULL | Amount of seconds. |
Returns
| Type | Description |
|---|---|
DURATION NOT NULL | A duration value. |
weeksAgo
weeksAgoweeksAgo(value: INT NOT NULL) → DATE NOT NULLReturns the date/time that is the given number of weeks before now.
Arguments
| Name | Type | Description |
|---|---|---|
value | INT NOT NULL | Offset in weeks. |
Returns
| Type | Description |
|---|---|
DATE NOT NULL | A date/time value representing now minus the specified offset. |
String similarity and matching
Use these functions to perform operations based on fuzzy matching.
fuzzyMatchExact
fuzzyMatchExactfuzzyMatchExact(str1: STRING, str2: STRING) → BOOL NOT NULLReturns true if the normalized Levenshtein similarity of the strings is 1. Before comparison, strings are normalized by converting to lowercase and removing special characters and redundant whitespace.
Arguments
| Name | Type | Description |
|---|---|---|
str1 | STRING | First string to compare. |
str2 | STRING | Second string to compare. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
fuzzyMatchStrict
fuzzyMatchStrictfuzzyMatchStrict(str1: STRING, str2: STRING) → BOOL NOT NULLReturns true if the normalized Levenshtein similarity of the strings is 0.9 or higher. Before comparison, strings are normalized by converting to lowercase and removing special characters and redundant whitespace.
Arguments
| Name | Type | Description |
|---|---|---|
str1 | STRING | First string to compare. |
str2 | STRING | Second string to compare. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
fuzzyMatchDefault
fuzzyMatchDefaultfuzzyMatchDefault(str1: STRING, str2: STRING) → BOOL NOT NULLReturns true if the normalized Levenshtein similarity of the two strings is 0.8 or higher. Before comparison, strings are normalized: converted to lowercase, with all special characters and redundant whitespace removed.
Arguments
| Name | Type | Description |
|---|---|---|
str1 | STRING | First string to compare. |
str2 | STRING | Second string to compare. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
fuzzyMatchFuzzy
fuzzyMatchFuzzyfuzzyMatchFuzzy(str1: STRING, str2: STRING) → BOOL NOT NULLReturns true if the normalized Levenshtein similarity of the strings is 0.6 or higher. Before comparison, strings are normalized by converting to lowercase and removing special characters and redundant whitespace.
Arguments
| Name | Type | Description |
|---|---|---|
str1 | STRING | First string to compare. |
str2 | STRING | Second string to compare. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
fuzzyMatchValue
fuzzyMatchValuefuzzyMatchValue(str1: STRING, str2: STRING) → FLOAT NOT NULLReturns the normalized Levenshtein similarity of the strings as a value in the range [0.0, 1.0]. Before comparison, strings are normalized by converting to lowercase and removing special characters and redundant whitespace.
Arguments
| Name | Type | Description |
|---|---|---|
str1 | STRING | First string to compare. |
str2 | STRING | Second string to compare. |
Returns
| Type | Description |
|---|---|
FLOAT NOT NULL | Normalized Levenshtein similarity in the range. |
personNamesIncompatible
personNamesIncompatiblepersonNamesIncompatible(str1: STRING, str2: STRING) → BOOL NOT NULLReturns true if the two person names are unlikely to belong to the same person. Names are normalized and compared by exact token matching, including containment of one name's tokens within the other's.
Arguments
| Name | Type | Description |
|---|---|---|
str1 | STRING | First person name to compare. |
str2 | STRING | Second person name to compare. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
personNamesFuzzyIncompatible
personNamesFuzzyIncompatiblepersonNamesIncompatible(str1: STRING, str2: STRING) → BOOL NOT NULLReturns true if the two person names are unlikely to belong to the same person, using fuzzy token matching to also account for typos and transliteration differences. Names are normalized the same way as in personNamesIncompatible, with an additional Levenshtein-distance comparison applied to tokens that don't match exactly.
Arguments
| Name | Type | Description |
|---|---|---|
str1 | STRING | First person name to compare. |
str2 | STRING | Second person name to compare. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
Geo and spatial
Use these functions to perform geo and spatial operations.
greatCircleDistance
greatCircleDistancegreatCircleDistance(lat1: FLOAT, lon1: FLOAT, lat2: FLOAT, lon2: FLOAT) → FLOATCalculates the great-circle distance between two points on the Earth in meters.
Arguments
| Name | Type | Description |
|---|---|---|
lat1 | FLOAT | Latitude of the first point in decimal degrees. |
lon1 | FLOAT | Longitude of the first point in decimal degrees. |
lat2 | FLOAT | Latitude of the second point in decimal degrees. |
lon2 | FLOAT | Longitude of the second point in decimal degrees. |
Returns
| Type | Description |
|---|---|
FLOAT | The distance between two points in meters. |
greatCircleDistanceRad
greatCircleDistanceRadgreatCircleDistanceRad(lat1: FLOAT, lon1: FLOAT, lat2: FLOAT, lon2: FLOAT) → FLOATCalculates the great-circle distance between two points on the Earth in meters.
Arguments
| Name | Type | Description |
|---|---|---|
lat1 | FLOAT | Latitude of the first point in radians. |
lon1 | FLOAT | Longitude of the first point in radians. |
lat2 | FLOAT | Latitude of the second point in radians. |
lon2 | FLOAT | Longitude of the second point in radians. |
Returns
| Type | Description |
|---|---|
FLOAT | The distance between two points in meters. |
Map or grouping
Use these functions to perform operations based on mapping/grouping.
countBy
countBycountBy(value: (S : OBJECT NOT NULL) ->K) → MAP<K NOT NULL, INT>Groups elements by key and counts occurrences.
Arguments
| Name | Type | Description |
|---|---|---|
value | (S : OBJECT NOT NULL) ->K | Function used to derive grouping keys. |
Returns
| Type | Description |
|---|---|
MAP\<K NOT NULL, INT> | Resulting map. |
map
mapmap(a: STRING NOT NULL, b: V) → MAP<STRING NOT NULL, V>map(a: INT NOT NULL, b: V) → MAP<INT NOT NULL, V>map(a: DATE NOT NULL, b: V) → MAP<DATE NOT NULL, V>Creates a map with a single key/value pair.
Arguments
| Name | Type | Description |
|---|---|---|
a | STRING NOT NULL | INT NOT NULL | DATE NOT NULL | Map key/value component. |
b | V | Map key/value component. |
Returns
| Type | Description |
|---|---|
MAP\<STRING NOT NULL, V> | MAP\<INT NOT NULL, V> | MAP\<DATE NOT NULL, V> | Resulting map. |
mapKeys
mapKeysmapKeys(map: MAP<K : OBJECT NOT NULL NOT NULL, V>) → K : OBJECT NOT NULL[]Returns an array containing all keys from the map.
Arguments
| Name | Type | Description |
|---|---|---|
map | MAP<K : OBJECT NOT NULL NOT NULL, V> | Input map. |
Returns
| Type | Description |
|---|---|
K : OBJECT NOT NULL[] | Resulting array. |
mapValues
mapValuesmapValues(map: MAP<K : OBJECT NOT NULL NOT NULL, V>) → V[]Returns an array containing all values from the map.
Arguments
| Name | Type | Description |
|---|---|---|
map | MAP<K : OBJECT NOT NULL NOT NULL, V> | Input map. |
Returns
| Type | Description |
|---|---|
V[] | Resulting array. |
sumBy
sumBysumBy(a: (S) ->K : OBJECT NOT NULL, b: (S) ->NUMBER) → MAP<K : OBJECT NOT NULL NOT NULL, NUMBER>Groups elements by key and sums extracted numeric values.
Arguments
| Name | Type | Description |
|---|---|---|
a | (S) ->K : OBJECT NOT NULL | Functions used to derive grouping keys and numeric values. |
b | (S) ->NUMBER | Functions used to derive grouping keys and numeric values. |
Returns
| Type | Description |
|---|---|
MAP<K : OBJECT NOT NULL NOT NULL, NUMBER> | Resulting map. |
sumMap
sumMapsumMap(value: MAP<K : OBJECT NOT NULL NOT NULL, INT>*) → MAP<K : OBJECT NOT NULL NOT NULL, INT>sumMap(value: MAP<K : OBJECT NOT NULL NOT NULL, FLOAT>*) → MAP<K : OBJECT NOT NULL NOT NULL, FLOAT>Sums maps with identical keys, producing a merged map.
Arguments
| Name | Type | Description |
|---|---|---|
value | MAP<K : OBJECT NOT NULL NOT NULL, INT>* | MAP<K : OBJECT NOT NULL NOT NULL, FLOAT>* | Input maps to sum/merge. |
Returns
| Type | Description |
|---|---|
MAP<K : OBJECT NOT NULL NOT NULL, INT> | MAP\<K : OBJECT NOT NULL NOT NULL, FLOAT> | Resulting map. |
Nullability and type utilities
Use these functions to perform operations based on nullability and type utilities.
exists
existsexists(value: V*) → BOOLReturns true if the stream contains at least one element.
Arguments
| Name | Type | Description |
|---|---|---|
value | V | Parameter. |
Returns
| Type | Description |
|---|---|
BOOL | Boolean result. |
ifNull
ifNullifNull(value: V, def: V NOT NULL) → V NOT NULLReturns the value if it is not null, otherwise returns the default.
Arguments
| Name | Type | Description |
|---|---|---|
value | V | Input value (may be null). |
def | V NOT NULL | Default value returned when input is null. |
Returns
| Type | Description |
|---|---|
V NOT NULL | Selected value. |
isNotNull
isNotNullisNotNull(value: OBJECT) → BOOL NOT NULLReturns true if the value is not null.
Arguments
| Name | Type | Description |
|---|---|---|
value | OBJECT | Parameter. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
isNull
isNullisNull(value: OBJECT) → BOOL NOT NULLReturns true if the value is null.
Arguments
| Name | Type | Description |
|---|---|---|
value | OBJECT | Parameter. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
notNull
notNullnotNull(value: V) → V NOT NULLAsserts that the value is not null and returns it as NOT NULL.
Arguments
| Name | Type | Description |
|---|---|---|
value | v | Input value expected to be not null. |
Returns
| Type | Description |
|---|---|
V NOT NULL | Selected value. |
toNullable
toNullabletoNullable(value: V) → VCasts a value to a nullable type (removes NOT NULL constraint).
Arguments
| Name | Type | Description |
|---|---|---|
value | V | Input value. |
Returns
| Type | Description |
|---|---|
V | Selected value. |
Numeric comparisons and logic
Use these functions to perform operations based on numeric comparisons and logic.
between
betweenbetween(value: FLOAT, min: FLOAT NOT NULL, max: FLOAT NOT NULL) → BOOLReturns true if value is within the inclusive range [min, max].
Arguments
| Name | Type | Description |
|---|---|---|
value | FLOAT | Value to test. |
min | FLOAT NOT NULL | Lower bound (inclusive). |
max | FLOAT NOT NULL | Upper bound (inclusive). |
Returns
| Type | Description |
|---|---|
BOOL | Boolean result. |
greater
greatergreater(a: NUMBER, b: NUMBER) → BOOLReturns true if a is greater than b.
Arguments
| Name | Type | Description |
|---|---|---|
a | NUMBER | First numeric argument. |
b | NUMBER | Second numeric argument. |
Returns
| Type | Description |
|---|---|
BOOL | Boolean result. |
greaterOrEquals
greaterOrEqualsgreaterOrEquals(a: NUMBER, b: NUMBER) → BOOLReturns true if a is greater than or equal to b.
Arguments
| Name | Type | Description |
|---|---|---|
a | NUMBER | First numeric argument. |
b | NUMBER | Second numeric argument. |
Returns
| Type | Description |
|---|---|
BOOL | Boolean result. |
if
ifif(expression: BOOL, v1: V, v2: V) → VConditional expression: returns v1 if expression is true, otherwise v2.
Arguments
| Name | Type | Description |
|---|---|---|
expression | BOOL | Condition to evaluate. |
v1 | V | Value returned when condition is true. |
v2 | V | Value returned when condition is false. |
Returns
| Type | Description |
|---|---|
V | Selected value. |
less
lessless(a: NUMBER, b: NUMBER) → BOOLReturns true if a is less than b.
Arguments
| Name | Type | Description |
|---|---|---|
a | NUMBER | First numeric argument. |
b | NUMBER | Second numeric argument. |
Returns
| Type | Description |
|---|---|
BOOL | Boolean result. |
lessOrEquals
lessOrEqualslessOrEquals(a: NUMBER, b: NUMBER) → BOOLReturns true if a is less than or equal to b.
Arguments
| Name | Type | Description |
|---|---|---|
a | NUMBER | First numeric argument. |
b | NUMBER | Second numeric argument. |
Returns
| Type | Description |
|---|---|
BOOL | Boolean result. |
Numeric math and statistics
Use these functions to perform operations based on the numeric math and statistics.
abs
absabs(value: INT) → INTabs(value: FLOAT) → FLOATReturns the absolute value.
Arguments
| Name | Type | Description |
|---|---|---|
value | INT | FLOAT | Parameter. |
Returns
| Type | Description |
|---|---|
INT | FLOAT | Numeric result. |
avg
avgavg(stream: V : NUMBER*) → FLOATAverage of a stream of numbers.
Arguments
| Name | Type | Description |
|---|---|---|
stream | V : NUMBER* | Stream of numbers. |
Returns
| Type | Description |
|---|---|
FLOAT | Average of the stream. |
diffPct
diffPctdiffPct(a: NUMBER, b: NUMBER) → FLOATReturns the percent difference between two numbers: 100 * abs((a - b) / b), with non-finite handling.
Arguments
| Name | Type | Description |
|---|---|---|
a | NUMBER | First numeric argument. |
b | NUMBER | Second numeric argument. |
Returns
| Type | Description |
|---|---|
FLOAT | Numeric result. |
diffPctMax
diffPctMaxdiffPctMax(a: NUMBER, b: NUMBER) → FLOATReturns the percent difference normalized by max(abs(a), abs(b)): 100 * abs((a - b) / max(...)), with non-finite handling.
Arguments
| Name | Type | Description |
|---|---|---|
a | NUMBER | First numeric argument. |
b | NUMBER | Second numeric argument. |
Returns
| Type | Description |
|---|---|
FLOAT | Numeric result. |
max
maxmax(l: NUMBER, r: NUMBER) → FLOATReturns the larger of two numbers.
Arguments
| Name | Type | Description |
|---|---|---|
l | NUMBER | First numeric argument. |
r | NUMBER | Second numeric argument. |
Returns
| Type | Description |
|---|---|
FLOAT | Numeric result. |
max
maxmax(stream: V : COMPARABLE*) → V : COMPARABLEMaximum of a stream of Comparable elements
Arguments
| Name | Type | Description |
|---|---|---|
stream | V : COMPARABLE* | Stream of comparable elements. |
Returns
| Type | Description |
|---|---|
V : COMPARABLE | Maximum of the stream. |
min
minmin(l: NUMBER, r: NUMBER) → FLOATReturns the smaller of two numbers.
Arguments
| Name | Type | Description |
|---|---|---|
l | NUMBER | First numeric argument. |
r | NUMBER | Second numeric argument. |
Returns
| Type | Description |
|---|---|
FLOAT | Numeric result. |
min
minmin(stream: V : COMPARABLE*) → V : COMPARABLEMinimum of a stream of comparable elements.
Arguments
| Name | Type | Description |
|---|---|---|
stream | V : COMPARABLE* | Stream of comparable elements. |
Returns
| Type | Description |
|---|---|
V : COMPARABLE | Minimum of the stream. |
modulo
modulomodulo(a: FLOAT, b: FLOAT) → FLOATmodulo(a: INT, b: INT) → INTReturns the remainder of division (a % b).
Arguments
| Name | Type | Description |
|---|---|---|
a | FLOAT | INT | First numeric argument. |
b | FLOAT | INT | Second numeric argument. |
Returns
| Type | Description |
|---|---|
FLOAT | INT | Numeric result. |
moduloOrZero
moduloOrZeromoduloOrZero(a: FLOAT, b: FLOAT) → FLOATmoduloOrZero(a: INT, b: INT) → INTReturns a % b; if b is zero, returns 0 to avoid division by zero.
Arguments
| Name | Type | Description |
|---|---|---|
a | FLOAT | INT | First numeric argument. |
b | FLOAT | INT | Second numeric argument. |
Returns
| Type | Description |
|---|---|
FLOAT | INT | Numeric result. |
round
roundround(a: FLOAT) → INTRounds the floating-point value to the nearest integer.
Arguments
| Name | Type | Description |
|---|---|---|
a | FLOAT | Parameter. |
Returns
| Type | Description |
|---|---|
INT | Result value. |
stddevSamp
stddevSampstddevSamp(stream: V : NUMBER*) → FLOATSample standard deviation of a stream.
Arguments
| Name | Type | Description |
|---|---|---|
stream | V : NUMBER* | Stream. |
Returns
| Type | Description |
|---|---|
FLOAT | Sample standard deviation. |
sum
sumsum(value: INT*) → INTsum(value: FLOAT*) → FLOATReturns the sum of all numbers in the stream.
Arguments
| Name | Type | Description |
|---|---|---|
value | FLOAT | INT | Input numeric stream. |
Returns
| Type | Description |
|---|---|
FLOAT | INT | Numeric result. |
Stream aggregations
Use these functions to perform operations based on stream aggregations.
allValues
allValuesallValues(stream: V*) → V[]List of non-null values of the stream.
Arguments
| Name | Type | Description |
|---|---|---|
stream | V | Stream. |
Returns
| Type | Description |
|---|---|
V[] | List of non-null values of the stream. |
anyValue
anyValueanyValue(stream: V*) → VAny value from a stream.
Arguments
| Name | Type | Description |
|---|---|---|
stream | V | Stream. |
Returns
| Type | Description |
|---|---|
V | Any value from a stream. |
count
countcount(stream: V*) → INTNumber of elements in a stream.
Arguments
| Name | Type | Description |
|---|---|---|
stream | V | Stream to count. |
Returns
| Type | Description |
|---|---|
INT | Number of elements in a stream. |
count
countcount() → (VOID*) ->INTAggregates a stream and returns a derived value.
Returns
| Type | Description |
|---|---|
(VOID*) ->INT | Resulting integer value. |
distinct
distinctdistinct(stream: V*) → V[]A copy of given stream without duplicates.
Arguments
| Name | Type | Description |
|---|---|---|
stream | V | Stream. |
Returns
| Type | Description |
|---|---|
V[] | Stream without duplicates. |
distinctCount
distinctCountdistinctCount(stream: V*) → INTAmount of distinct elements in the stream.
Arguments
| Name | Type | Description |
|---|---|---|
stream | V | Stream. |
Returns
| Type | Description |
|---|---|
INT | Amount of distinct elements in the stream. |
firstValue
firstValuefirstValue(stream: V*) → VFirst value of a stream.
Arguments
| Name | Type | Description |
|---|---|---|
stream | V | Stream. |
Returns
| Type | Description |
|---|---|
V | First value of a stream. |
lastValue
lastValuelastValue(stream: V*) → VLast value of a stream.
Arguments
| Name | Type | Description |
|---|---|---|
stream | V | Stream. |
Returns
| Type | Description |
|---|---|
V | Last value of a stream. |
lastValues
lastValueslastValues(stream: V*, amount: INT NOT NULL) → V[]Last amount elements of the stream.
Arguments
| Name | Type | Description |
|---|---|---|
stream | V | Stream. |
amount | INT NOT NULL | Number of elements to keep. |
Returns
| Type | Description |
|---|---|
V[] | list containing last amount values of the stream. |
String operations
Use these functions to perform string operations.
endsWith
endsWithendsWith(s: STRING, suffix: STRING) → BOOL NOT NULLReturns true if the string ends with the given suffix.
Arguments
| Name | Type | Description |
|---|---|---|
s | STRING | Input string. |
suffix | STRING | Suffix to check. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Result value. |
equalsIgnoreCase
equalsIgnoreCaseequalsIgnoreCase(s: STRING, p: STRING) → BOOL NOT NULLReturns true if the two strings are equal ignoring case.
Arguments
| Name | Type | Description |
|---|---|---|
s | STRING | Input string. |
p | STRING | String to compare with. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
matches
matchesmatches(s: STRING, pattern: STRING) → BOOL NOT NULLReturns true if the string matches the given regular expression pattern.
Arguments
| Name | Type | Description |
|---|---|---|
s | STRING | Input string. |
pattern | STRING | Regular expression pattern. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Boolean result. |
startsWith
startsWithstartsWith(s: STRING, prefix: STRING) → BOOL NOT NULLReturns true if the string starts with the given prefix.
Arguments
| Name | Type | Description |
|---|---|---|
s | STRING | Input string. |
prefix | STRING | Prefix to check. |
Returns
| Type | Description |
|---|---|
BOOL NOT NULL | Result value. |
substring
substringsubstring(s: V : STRING, offset: INT NOT NULL, len: INT NOT NULL) → V : STRINGReturns a substring starting at the given offset with the given length.
Arguments
| Name | Type | Description |
|---|---|---|
s | V : STRING | Input string. |
offset | INT NOT NULL | Zero-based start index. |
len | INT NOT NULL | Number of characters to take. |
Returns
| Type | Description |
|---|---|
V : STRING | Resulting string. |
trim
trimtrim(s: STRING) → STRINGRemoves leading and trailing whitespace from a string.
Arguments
| Name | Type | Description |
|---|---|---|
s | STRING | Input string. |
Returns
| Type | Description |
|---|---|
STRING | Resulting string. |
Type casting
Use these functions to perform operations based on type casting.
BOOL
BOOLBOOL(obj: OBJECT) → BOOLCasts the given object to BOOL.
Arguments
| Name | Type | Description |
|---|---|---|
obj | OBJECT | Value to cast/check. |
Returns
| Type | Description |
|---|---|
BOOL | Value cast to BOOL. |
DATE
DATEDATE(obj: OBJECT) → DATECasts the given object to DATE.
Arguments
| Name | Type | Description |
|---|---|---|
obj | OBJECT | Value to cast/check. |
Returns
| Type | Description |
|---|---|
DATE | Value cast to DATE. |
DURATION
DURATIONDURATION(obj: OBJECT) → DURATIONCasts the given object to DURATION.
Arguments
| Name | Type | Description |
|---|---|---|
obj | OBJECT | Value to cast/check. |
Returns
| Type | Description |
|---|---|
DURATION | Value cast to DURATION. |
FLOAT
FLOATFLOAT(obj: OBJECT) → FLOATCasts the given object to FLOAT.
Arguments
| Name | Type | Description |
|---|---|---|
obj | OBJECT | Value to cast/check. |
Returns
| Type | Description |
|---|---|
FLOAT | Value cast to FLOAT. |
INT
INTINT(obj: OBJECT) → INTCasts the given object to INT.
Arguments
| Name | Type | Description |
|---|---|---|
obj | OBJECT | Value to cast/check. |
Returns
| Type | Description |
|---|---|
INT | Value cast to INT. |
NUMBER
NUMBERNUMBER(obj: OBJECT) → NUMBERCasts the given object to NUMBER.
Arguments
| Name | Type | Description |
|---|---|---|
obj | OBJECT | Value to cast/check. |
Returns
| Type | Description |
|---|---|
NUMBER | Value cast to NUMBER. |
STRING
STRINGSTRING(obj: OBJECT) → STRINGCasts the given object to STRING.
Arguments
| Name | Type | Description |
|---|---|---|
obj | OBJECT | Value to cast/check. |
Returns
| Type | Description |
|---|---|
STRING | Value cast to STRING. |
Other
Use these functions to perform operations not covered in the categories above.
ifNotFinite
ifNotFiniteifNotFinite(value: FLOAT, defValue: V : FLOAT) → V : FLOATReturns value if it is a finite number; otherwise returns defValue.
Arguments
| Name | Type | Description |
|---|---|---|
value | FLOAT | The value to check for finiteness. |
defValue | V : FLOAT | The value to return if value is not finite. |
Returns
| Type | Description |
|---|---|
V : FLOAT | The original value if it is finite; otherwise defValue. |
addScoreIf
addScoreIfaddScoreIf(expression: BOOL, score: INT) -> BOOLAdds the specified score to the transaction if the condition is true.
Arguments
| Name | Type | Description |
|---|---|---|
expression | BOOL | Condition to evaluate. |
score | INT | Score points to add. |
Returns
| Type | Description |
|---|---|
BOOL | Returns true if the condition is met and the score is added, otherwise false. |