Functions
Use the following functions to model the rule expressions or conditions.
Functions are listed in the autosuggest list only if they are relevant for the rule expression.
Time and Duration Functions
Time and duration functions let you perform operations on a date, time, and timestamp values. You can select the date and timestamp values from the date and time picker in the Fixed Value section. You can also enter the date or timestamp in the Fixed Value field using the syntax given in this section.
|
Function Name |
Function Syntax |
Example |
|---|---|---|
|
is in next |
ISINNEXT(<test value>, <quantity value>) |
ISINNEXT('2019-01-10','2 WK') |
|
is not in next |
ISNOTINNEXT(<test value>, <quantity value>) |
ISNOTINNEXT('2019-01-10T22:00:00Z','2 HR') |
|
is in last |
ISINLAST(<test value>, <quantity value>) |
ISINLAST(process.start time, '20 MIN') |
|
Today |
TODAY() |
Order.Shipdate = TODAY() |
|
Tomorrow |
TOMORROW() |
Order.Readydate = TOMORROW() |
|
Yesterday |
YESTERDAY() |
Order.Readydate = YESTERDAY() |
|
is not in last |
ISNOTINLAST(<test value>, <quantity value>) |
ISNOTINLAST(employee.birth year, '18 ANN') |
|
add seconds |
ADDSECONDS(<test value>, <quantity value>) |
ADDSECONDS(Employee.LoginTime,15) ADDSECONDS('2019-01-10T22:00:00Z', 20) |
|
add minutes |
ADDMINUTES(<test value>, <quantity value>) |
ADDMINUTES(Order.Time, 10) |
|
add hours |
ADDHOURS(<test value>, <quantity value>) |
ADDHOURS(Employee.LoginTime, 2) |
|
add days |
ADDDAYS(<test value>, <quantity value>) |
ADDDAYS(License.EndDate, 30) ADDDAYS('2019-01-30', 30) |
|
add weeks |
ADDWEEKS(<test value>, <quantity value>) |
ADDWEEKS('2019-01-20', 14) |
|
add months |
ADDMONTHS(<test value>, <quantity value>) |
ADDMONTHS(License.ExpiryDate, 4) ADDMONTHS('2019-01-30',1) |
|
add quarters |
ADDQUARTERS(<test value>, <quantity value>) |
ADDQUARTERS('2019-01-30', 3) This function return a date three quarters after 2019-01-30, that is, 2019-10-30 |
|
add years |
ADDYEARS(<test value>, <quantity value>) |
ADDYEARS(Employee.YearOfBirth,2) This function returns a date, two years after the input date. ADDYEARS('2019-01-30T18:00:00Z', 4) This function returns a timestamp value of '2023-01-30T18:00:00Z'. |
|
subtract seconds |
SUBTRACTSECONDS(<test value>, <quantity value>) |
SUBTRACTSECONDS(Employee.LoginTime, 10) SUBTRACTSECONDS('2019-01-20T22:00:00Z', 90) |
|
subtract minutes |
SUBTRACTMINUTES(<test value>, <quantity value>) |
SUBTRACTMINUTES('2019-01-30T22:00:00Z', 10) SUBTRACTMINUTES(Order.ShipTime, 20) |
|
subtract hours |
SUBTRACTHOURS(<test value>, <quantity value>) |
SUBTRACTHOURS(Plant.ShutDownTime,4) |
|
subtract days |
SUBTRACTDAYS(<test value>, <quantity value>) |
SUBTRACTDAYS(Plant.OpenDate, 10) |
|
subtract weeks |
SUBTRACTWEEKS(<test value>, <quantity value>) |
SUBTRACTWEEKS('2020-10-10',7) |
|
subtract months |
SUBTRACTMONTHS(<test value>, <quantity value>) |
SUBTRACTMONTHS(Customer.SignUpDate,1) |
|
subtract quarters |
SUBTRACTQUARTERS(<test value>, <quantity value>) |
SUBTRACTQUARTERS('2020-10-10', 2) This function returns a date, 2020-04-10 which is 2 quarters before 2020-10-10. |
|
subtract years |
SUBTRACTYEARS(<test value>, <quantity value>) |
SUBTRACTYEARS(Vehicle.MaufacturingDate, 2) This function returns a date which is 2 years before the Vehicle.MaufacturingDate |
|
seconds between |
SECONDSBETWEEN(<test value>, <quantity value>) |
SECONDSBETWEEN(Employee.LogoutTime, Employee.LoginTime) SECONDSBETWEEN('2019-01-10T22:00:00Z','10-01-2019T12:40:00Z' ) SECONDSBETWEEN('2019-01-10','2019-01-08' ) |
|
minutes between |
MINUTESBETWEEN(<test value>, <quantity value>) |
MINUTESBETWEEN(Employee.LogoutTime, Employee.LoginTime) MINUTESBETWEEN('2019-01-10T22:00:00Z','10-01-2019T12:40:00Z' ) MINUTESBETWEEN('2019-01-10','2019-01-08' ) |
|
hours between |
HOURSBETWEEN(<testValue>, <quantityValue>) |
HOURSBETWEEN(Employee.LogoutTime, Employee.LoginTime) HOURSBETWEEN('2019-01-10T22:00:00Z','2019-01-09T12:40:00Z' ) HOURSBETWEEN('2019-01-10','2019-01-08' ) |
|
days between |
DAYSBETWEEN(<test value>, <quantity value>) |
DAYSBETWEEN(TODAY(), Emplyee.JoiningDate) |
|
weeks between |
WEEKSBETWEEN(<testValue>, <quantity value>) |
WEEKSBETWEEN(TODAY(), Employee.JoiningDate) |
|
months between |
MONTHSBETWEEN(<test value>, <quantity value>) |
MONTHSBETWEEN(TODAY(),Employee.DateofBirth) MONTHSBETWEEN('2019-01-10','2018-01-01') |
|
quarters between |
QUARTERSBETWEEN(<test value>, <quantity value>) |
QUARTERSBETWEEN(TODAY(),Employee.DateofBirth |
|
years between |
YEARSBETWEEN(<test value>, <quantity value>) |
YEARSBETWEEN(TODAY(),Employee.DateofBirth) |
|
Second |
SECOND(<test value>) |
SECOND('2019-01-10T12:11:22.333Z') The function returns the seconds part of the timestamp, that is, 22.333 |
|
Minute |
MINUTE(<test value>) |
MINUTE('2019-01-10T12:11:22.333Z') The function returns the minutes part of the timestamp, that is, 11. |
|
Hour |
HOUR(<test value>) |
HOUR('2019-01-10T12:11:22.333Z') The function returns the hour part of the timestamp, that is, 12. |
|
Month |
MONTH(<test value>) |
MONTH('2019-01-10T22:11:22.333Z') The function returns the month part of the timestamp, that is, 01. MONTH('2019-10-15') The function returns the month part of the date, that is, 10. |
|
Year |
YEAR(<test value>) |
YEAR('2019-01-10T22:11:22.333Z') The function returns the year part of the timestamp, that is, 2019. YEAR('2019-10-15') The function returns the year part of the date, that is, 2019. |
|
Day of week |
DAYOFWEEK(<test value>) Returns the day of the week with Monday having a value of 1. Value ranges between 1 and 7. |
DAYOFWEEK('2019-01-10T22:11:22.333Z') The function returns a value of 4. |
|
Day of month |
DAYOFMONTH(<test value>) Returns the day of the month. Value ranges between 1 and 31. |
DAYOFMONTH('2019-01-10T22:11:22.333Z') The function returns a value of 10. |
|
Day of year |
DAYOFYEAR(<test value>) Returns the day of the year. Value ranges between 1 and 366 |
DAYOFYEAR('2019-01-10T22:11:22.333Z') The function returns a value of 10. |
|
Date |
DATE(<string>) This function returns only the date from a date-string. |
DATE("2022-05-23") The function returns the date, that is, 2022-05-23 DATE("2020-01-29T09:15:36Z") The function returns the date, that is, 2020-01-29 DATE("2025-01-13" + "T11:00:00Z") The function returns the date, that is, 2025-01-13 DATE(CONCAT("1990", "-09", "-12") The function returns 1990-09-12 |
Select Functions
Select functions let you retrieve select values from a table. You can configure the select functions, using the autosuggest list, in the Select Functions configuration window.
|
Function Name |
Function Syntax |
Example |
|---|---|---|
|
top |
TOP(table, number) |
TOP (customer,5) |
|
select |
SELECT(table, col1...coln) |
SELECT(customer, Rating, Region) |
|
first |
FIRST(table) |
FIRST(customer) |
Aggregate Functions
Aggregate functions let you perform calculations on a set of values and return a single result value or a set of result values.
|
Function Name |
Function Syntax |
Examples |
|---|---|---|
|
average |
AVERAGE(table, column, indexcolumn1..indexcolumnN) |
AVG (customer, orderAmount) |
|
sum |
SUM(table, column, indexcolumn1..indexcolumnN |
SUM (customer, OrderAmount) |
|
count |
COUNT(table, indexcolumn1..indexcolumnN) |
COUNT(customers) |
|
count distinct |
COUNTDISTINCT(table, column) |
COUNTDISTINCT(customers, region) |
|
minimum |
MIN(table, column, indexcolumn1..indexcolumnN) |
MIN(customer, orderAmount) |
|
maximum |
MAX(table, column, indexcolumn1..indexcolumnN) |
MAX(customer, orderAmount) |
Advanced Functions
Advanced functions can be used to perform advanced operations on string, mathematical, amount and geographical values.
|
Function Name |
Function Syntax |
Examples |
|---|---|---|
|
concatenate |
CONCAT(<string1>,<string2>,<string3>.….<stringN>) |
CONCAT('Firstname','LastName') CONCAT( Contact_S.ContactName , 'abc', 'def' ) |
|
round |
ROUND(<number>,<value>) |
ROUND(customer.credit_rating,2) |
|
power |
POWER(<number>,<power>) |
POWER(2,3) |
|
sin |
SIN(<number>) |
SIN(2) |
|
cos |
COS(<number>) |
COS(2) |
|
is within |
ISWITHIN(<coordinates of the point>, <coordinates of the polygon>) |
ISWITHIN( customer.location , '{"type": "Polygon","coordinates": [[100.0, 0.0],[101.0, 0.0],[101.0, 1.0],[100.0, 1.0],[100.0, 0.0]]}') |
|
is not within |
ISNOTWITHIN(<coordinates of the point>, <coordinates of the polygon>) |
ISNOTWITHIN( customer.location , '{"type": "Polygon","coordinates": [[100.0, 0.0],[101.0, 0.0],[101.0, 1.0],[100.0, 1.0],[100.0, 0.0]]}') |
|
is null |
ISNULL(<Data object of type Element>) |
ISNULL(Customer.ContactName) |
|
is not null |
ISNOTNULL(<Data object of type Element>) |
ISNOTNULL(Customer.ContactName) |
|
is lowercase This function checks if all characters in a given text string are lowercase. |
ISLOWERCASE(<string>) |
ISLOWERCASE('customer')→ returns TRUE ISLOWERCASE('CustomeR')→ returns FALSE |
|
is uppercase This function checks if all characters in a given text string are uppercase. |
ISUPPERCASE(<string>) |
ISUPPERCASE('CUSTOMER') →returns TRUE ISUPPERCASE('CusTOMER') →returns FALSE |
|
string length This function counts and returns the number of characters in a given text string. |
STRINGLENGTH(<string>) |
STRINGLENGTH('customer')→returns 8 STRINGLENGTH('')→ returns 0 |
|
digit count This function counts and returns the number of digits in a number, up to a maximum of 16 digits. |
DIGITCOUNT(<number>) |
DIGITCOUNT(123)→returns 3 DIGITCOUNT(123.456)→returns 6 |
|
is numeric This function checks if a text value is a number. |
ISNUMERIC (<string>) |
ISNUMERIC('123') →returns TRUE ISNUMERIC('abc')→returns FALSE |
|
min value
This function returns the earliest of two or more numbers, dates, or timestamps.
|
MINVALUE (<Date 1>, <Date 2>) MINVALUE (<Number 1>, <Number 2>) MINVALUE (<Timestamp 1>, <Timestamp 2>) |
MINVALUE ('2024-05-07', '2024-05-08')→returns 2024-05-07 MINVALUE (1,2)→returns 1 MINVALUE ('2024-05-07T22:00:00Z', '2024-05-07T23:00:00Z') →returns 2024-05-07T22:00:00Z |
|
max value
This function returns the latest of two or more numbers, dates, or timestamps.
|
MAXVALUE (<Date 1>, <Date 2>) MAXVALUE (<Number 1>, <Number 2>) MAXVALUE (<Timestamp 1>, <Timestamp 2>) |
MAXVALUE ('2024-05-07', '2024-05-08')→returns 2024-05-08 MAXVALUE (1,2)→returns 2 MAXVALUE ('2024-05-07T22:00:00Z', '2024-05-07T23:00:00Z') →returns 2024-05-07T23:00:00Z |
|
sub string This function returns a specified number of characters from a given text string. |
SUBSTRING(<string>, <start_position>, <substring_length>) <string>: Specifies the string containing the substring. <start_position>: Specifies where the substring starts within the string. <substring_length>: Specifies the substring length.
If <start_position> is greater than the length of the string, an empty string is returned.
Example
SUBSTRING(Customer, 15, 4) →returns '' |
SUBSTRING(Customer, 1, 4) →returns 'Cust' SUBSTRING('Cus_tomer', 1, 4) →returns 'Cus_' SUBSTRING('Cus tomer', 1, 4) →returns 'Cus ' |
|
string replace This function replaces occurrences of a specified text (search_string) with a new text (replace_string) in the given string (original_string). |
STRINGREPLACE(<original_string>, <search_string>, <replace_string>) <original_string>: Specifies the initial text string. <search_string>: Specifies the text string to be replaced. <replace_string>: Specifies the new text string to replace the search string.
Note
|
STRINGREPLACE("This is a string", "string", "text") →returns "This is a text" STRINGREPLACE("string", "", " ") -> " s t r i n g " STRINGREPLACE("This is a string", "string", "") -> "This is a " STRINGREPLACE("string", "i", "") -> "strng" |
|
sub string count This function counts occurrences of a substring within a list of strings. If using a single string, it must be provided as a list.
Note
|
Note
If any of the input parameters is empty or null, the function returns 0.
Example
SUBSTRINGCOUNT(["hello"], "")→returns 0 SUBSTRINGCOUNT(null, "hello")→returns 0 |
SUBSTRINGCOUNT(["hello", "hello", "hello"], "hello") →returns 3 SUBSTRINGCOUNT(["hello world", "hello universe", "hello again!"], " ") →returns 3 SUBSTRINGCOUNT(["Hello hello HeLLo"], "hello") →returns 1 SUBSTRINGCOUNT([CONCAT('Hi', 'Hello'), 'Hello again'], 'Hello') →returns 2 SUBSTRINGCOUNT(SELECT(Employees) , 'BPM')→returns matching count considering the entire table for the provided attribute. |
|
trunc This function removes the fractional part of a number without rounding, up to a specified number of decimal places. |
TRUNC(<number>, <num_digits>) <number>: Specifies The value to be truncated. <num_digits>: Specifies the number of decimal places to retain.
Note
|
TRUNC(123.456789, 2) →returns 123.45 TRUNC(987.654, 5) →returns 987.654 TRUNC(12345.67, -2) →returns 12300.0 TRUNC(-12345.67, -2) →returns -12300.0 TRUNC(123.45678, 10.0) →returns 123.45678 TRUNC (123.45678, -10.0) →returns 0.0 |
|
list contains any This function checks if the first list contains any elements from the second list, returning TRUE if it does and FALSE otherwise.
Note
Single value should also be provided as a list. |
LISTCONTAINSANY(<SELECT function>, <SELECT function>) LISTCONTAINSANY(<SELECT function>, <array of values>)
Note
The input parameters must be of the same type. For example, if the first parameter is a SELECT function on a field of type string, the second one should also be a SELECT on a field of type string or a list of strings. |
LISTCONTAINSANY(SELECT(PrimarySkill where Department="Software" ), SELECT(RequiredSkills)) →returns TRUE if the provided PrimarySkill list contains at least one value from the RequiredSkills list LISTCONTAINSANY(SELECT(PrimarySkill), ["Welding", "Soldering"]) →returns TRUE if the provided PrimarySkill list contains either Welding or Soldering. |
|
list contains pattern This function checks if any element in a given list matches a regular expression pattern, returning TRUE if it does and FALSE otherwise. |
LISTCONTAINSPATTERN (<SELECT function>, <string>). |
LISTCONTAINSPATTERN(SELECT(PrimarySkill where Department="Software" ), "Ja.a") →returns TRUE if the provided PrimarySkill list contains the pattern "Ja.a". LISTCONTAINSPATTERN(SELECT(PrimarySkill), "Weld%") →returns TRUE if the provided PrimarySkill list contains the pattern "Weld%". |
|
list contains range This function checks if a given list contains at least one value within a given range of values. |
ListContainsRange(<SELECT function>, [Value Range]) You can use round brackets - '(' or ')' - to exclude the limit values and square brackets - '[' or ']' - to include the limit values. |
LISTCONTAINSRANGE(SELECT(DeptId), [100..200])→returns TRUE if any of the values in the provided DeptId list is between 100 and 200, including 100 and 200. LISTCONTAINSRANGE(SELECT(DeptId), (100..200))→returns TRUE if any of the values in the provided DeptId list is between 100 and 200, excluding 100 and 200. LISTCONTAINSRANGE(SELECT(DeptId), [100..200))→returns TRUE if any of the values in the provided DeptId list is between 100 and 200, excluding 200. LISTCONTAINSRANGE(SELECT(DeptId), (100..200])→returns TRUE if any of the values in the provided DeptId list is between 100 and 200, excluding 100 |
Select and Aggregate Functions in Decision Tables in Spreadsheet
|
Function Name |
Function Syntax |
Example |
|---|---|---|
|
sort ascending |
SORTASC(table,column) |
Average(Filter(SortAsc(Customer, Name), Age > 30, player_height) |
|
sort descending |
SORTDESC(table,column)) |
|
|
filter |
filter(table, condition) |
Filter is the same as the Where field in aggregate and select function configuration windows.
Functions for Text Rule Execute Operations
The following execute operations and loop functions can be used while modeling a text rule without a result data object..
|
Function |
Syntax |
Input |
Description |
Example |
|---|---|---|---|---|
|
Update |
UPDATE(<Target>, <Source>) |
Target Entity |
The target data object or attribute of type Structure or Element, that should be updated as per the value of the Source. |
UPDATE( Customer.Employee Name, Employee.Employee Name ) The data object, Customer.Employee Name is updated as per the value of Employee.Employee Name. |
|
Source Entity or Source Expression. |
The value of the Target Entity is updated to the value of the Source Entity or the value returned by the Source Expression. The Target and Source should be of the same data object type.
Note
You can also use resuable rules as the source expression by selecting them from the autosuggest list. |
|||
|
Append |
APPEND(<Target>, <Source>) |
Target Entity |
The target data object of type Table to which the Source has to be appended. |
APPEND(FlightTable, Flight) The data object Flight is appended to the data object FlightTable. |
|
Source Entity or Source Expression |
A data object that should be appended to the Target data object. The source data object should be of type Structure or Table or a rule that returns a data object of type Structure or Table. |
|
Loop Function |
Syntax |
Input |
Description |
Example |
|---|---|---|---|---|
|
For each item |
FOREACHITEM(<Vocabulary>, < currentitem>) |
Vocabulary which is a data object of type Table or a rule that returns a data object of type Table. The current item is a decision variable pointing to the same type as the table |
You can also provide additional filter conditions for performing the execute operations |
FOREACHITEM(FlightTable, FlightItem) |
|
Single or multiple execute operations to be executed in a loop |