Scripting operators and operands
The code editor provides the ARIS process language that supports the operators and operands listed below.
An operation consists of an operator and one or more operands, for example, operand1 + operand2. In the functional notation of an operation, the operator is followed by the operands enclosed in parentheses ( ), where the operands are separated by a comma (,), for example, ACTIVITY_PU_AVG(field: Field | Calculation, filter?: Boolean).
Optional operands are marked with "?".
You can create nested operations by replacing an operand within an operation with another operation.
Use parentheses ( ) to force the execution order.
List of operands supported by the ARIS process language:
Operands | Subtype | Syntax | Description |
Objects/fields | "object_name"."field_name" | Field and object names are enclosed in double quotes. | |
Constant | String | 'value' | Values are enclosed in single quotation marks. |
Date | DATE(2022-12-21 15:00:35) #pattern is for example: year-month-day hour:minute:milliseconds (mandatory: year optional: month-day optional: hour:minute:milliseconds) | ||
Number (Long) | 123 | ||
Number (Double) | 12.34 | ||
Null | No number | NULL_NUMBER | |
No text | NULL_TEXT | ||
No date | NULL_DATE |
List of operators supported by the ARIS process language:
Operator type | Subtype | Syntax | Description |
Math | Addition | operand1 + operand2 | |
Subtraction | operand1 - operand2 | ||
Division | operand1 / operand2 | ||
Multiplication | operand1 * operand2 | ||
MIN | MIN (value1: long | double, value2: long | double) | Minimum Returns the minimum of the values provided. | |
MAX | MAX (value1: long | double, value2: long | double) | Maximum Returns the maximum of the values provided. | |
ABS | ABS (value: long | double) | Absolute Returns the absolute value of the number. | |
CEIL | CEIL (value: long | double) | Round up Returns the smallest double value that is greater than or equal to the argument and equal to a mathematical integer. | |
Floor | FLOOR (value: long | double) | Round down Returns the largest double value that is less than or equal to the argument and equal to a mathematical integer. | |
Round | ROUND (value: long | double) | Round Returns the integer closest to the given value. | |
Comparison | Equals | operand1 = operand2 | |
Not equals | operand1 != operand2 | ||
Less | operand1 < operand2 | ||
Less or equal | operand1 <= operand2 | ||
Greater | operand1 > operand2 | ||
Greater or equals | operand1 => operand2 | ||
Starts with | STARTS_WITH (value: text, searchText: text) | Checks if the provided text starts with the search text. | |
Ends with | ENDS_WITH (value: text, searchText: text) | Checks if the text provided ends with the search text. | |
Contains | CONTAINS (value: text, searchText: text) | Checks if the text provided contains the search text. | |
Before | BEFORE (date1: date, date2: date) | Returns whether the first date is before the second date. | |
After | AFTER (date1: date, date2: date) | Returns whether the first date is after the second date. | |
Exists | EXISTS (value: date | number | text) | Checks if a value exists (if a value is not NULL). | |
Not exists | DOES_NOT_EXIST (value: date | number | string) | Checks if a value does not exist (if a value is NULL). | |
In | value IN (value1, value2, value4,…) | Checks if a value is contained in the given list of values. | |
Parse date | PARSE_DATE (value: text, pattern: text) #pattern is optional default is "yyyy-MM-dd hh:mm:ss" | Parse a date. Parses the given text to produce a date. | |
Move date | Add milliseconds | ADD_MILLIS (date: date, amount: long) | Adds/subtracts the specified amount of milliseconds to/from the given date, based on calendar rules. |
Add milliseconds (work time) | ADD_MILLIS (date: date, amount: long, calendar: Calendar, timeZone: zoneId) 1,2,3 | Returns the date resulting of adding the given amount of milliseconds to the given date with reference to the work time intervals defined in the calendar for the timezone zoneId. | |
Add seconds | ADD_SECONDS (date: date, amount: long) | Adds/subtracts the specified amount of seconds to/from the given date, based on calendar rules. | |
Add seconds (work time) | ADD_SECONDS (date: date, amount: long, calendar: Calendar, timezone: zoneId) 1,2,3 | Returns the date resulting of adding the given amount of seconds to the given date with reference to the work time intervals defined in the calendar for the timezone zoneId. | |
Add minutes | ADD_MINUTES (date: date, amount: long) | Adds/subtracts the specified amount of minutes to/from the given date, based on calendar rules. | |
Add minutes (work time) | ADD_MINUTES (date: date, amount: long, calendar: Calendar, timezone: zoneId) 1,2,3 | Returns the date resulting of adding the given amount of minutes to the given date with reference to the work time intervals defined in the calendar for the timezone zoneId. | |
Add hours | ADD_HOURS (date: date, amount: long) | Adds/subtracts the specified amount of hours to/from the given date, based on calendar rules. | |
Add hours (work time) | ADD_HOURS (date: date, amount: long, calendar: Calendar, timezone: zoneId) 1,2,3 | Returns the date resulting of adding the given amount of hours to the given date with reference to the work time intervals defined in the calendar for the timezone zoneId. | |
Add days | ADD_DAYS (date: date, amount: long) | Adds/subtracts the specified amount of days to/from the given date, based on calendar rules. | |
Add days (work time) | ADD_DAYS (date: date, amount: long, calendar: Calendar, timezone: zoneId) 1,2,3 | Returns the date resulting of adding the given amount of days to the given date with reference to the work time intervals defined in the calendar for the timezone zoneId. | |
Add workdays | ADD_WORKDAYS( date: date, amount: integer, calendar: Calendar, timezone: zoneId) | Returns the date resulting of adding the given amount of work days to the given date with reference to the work time intervals defined by the calendar in the timezone zoneId (default is UTC). Each day with any work time interval is considered as workday. The time of day of the resulting date is the same than the time in the original date. The Calendar operand is mandatory. | |
Time between | TIME_BETWEEN (date0: date0, date1: date1, calendar: Calendar, timezone: zoneId) | Returns the number of milliseconds between date0 and date1 with reference to the work time intervals defined in the calendar in timezone zoneId (default is UTC). The Calendar and zoneId operands are optional. | |
Workdays between | WORKDAY_BETWEEN (date0: date0, date1: date1, calendar: Calendar, timezone: zoneId) | Returns number of workdays between date0 and date1 with reference to the work time intervals defined in the calendar in timezone zoneId (default UTC). Each day with any work time interval will be considered as workday. The zoneId operand is optional. If the operand is not defined, UTC is used as the default timezone. | |
Is work time | IS_WORKING_TIME (date: date, calendar: Calendar, timezone: zoneId) | Returns true if the date is in a work time interval defined in the calendar in the timezone zoneId, else false. The zoneId operand is optional. If the operand is not defined, UTC is used as the default timezone. | |
Intersect | Intersect calendars | INTERSECT_CALENDAR (calendar1, calendar2) | Has two calendars as parameters and creates a calendar with work time intervals defining a work time that is defined in both calendars. |
Union | Union calendars | UNION_CALENDAR (calendar1, calendar2) | Has two calendars as parameters and creates a calendar with work time intervals defining a work time that is defined in at least one of both calendars. |
Extract text | SUBSTRING (value: text, startIndex: long, distance: long) | Returns the part of the text from the start index to the specified length or to the end of the string. | |
Find text | FIND_FIRST (value: text, searchText: text) | Returns the index within the given text of the first occurrence of the substring specified. | |
FIND_LAST (value: text, searchText: text) | Returns the index within the given text of the last occurrence of the substring specified. | ||
Remap text | REMAP (value: text, [fromValue: text, toValue: text], ...) | Replaces text values with other text values according to the specified mappings. | |
Replace text | REPLACE_ALL (value: text, findText: text, replaceText: text) | Replaces each string of text that matches the target string with the specified replacement string. | |
REPLACE_FIRST (value: text, findText: text, replaceText: text) | Replaces the first string of text that matches the target string with the specified replacement string. | ||
REPLACE_LAST (value: text, findText: text, replaceText: text) | Replaces the last string of text that matches the target string with the specified replacement string. | ||
Text length | LENGTH (value: text) | Returns the length of the text provided. | |
Concat | CONCAT (text1: text, text2: text, ...) | Concatenates the values provided. | |
Case when | CASE WHEN (condition: Boolean) THEN value: any ELSE value: any | Checks all conditions and returns the value of the first matching condition. | |
Condition | And | operand1 AND operand2 | |
Or | operand1 OR operand2 | ||
Not | NOT (operand1) or NOT operand | ||
Convert | TO_DOUBLE (value: long | text) | Converts the value provided into a double value. | |
TO_DATE (value: long) | Converts the value provided into a date. | ||
TO_LONG (value: long | text) | Converts the value provided into a long value. | ||
TO_TEXT (value: long | double | date) | Converts the value provided into text. |
Notes
1 The factoryCalendar operand is optional. If the operand is not defined, the normal operator (without factoryCalendar) is applied, otherwise the corresponding factoryCalendar based operator is applied.
2 The zoneId operand is optional. If the operand is not defined, UTC is used as the default timezone.
3 The operator may not be available to you. Availability depends on the product deployment you are using.
Field operators
Field operators reference a field in the analysis model.
There can exist two fields with the same ID in the analysis model. A field created by the user can have the same ID as a field generated by the system. If both fields are in the same table and you want to refer to one of these fields in a script, you must use the SYSTEM or CUSTOM operator, depending on which field you want to refer to.
Operator type | Subtype | Syntax | Description |
Field | FIELD | FIELD(field: Field, parameterValue1, parameterValue2, ...) FIELD("_ARIS.Case"."Costs", 'EUR') | References a field with parameters. |
SYSTEM | SYSTEM(field: Field) SYSTEM("_ARIS.Case"."Case duration") | References a system field with an identifier that is shared by the system and a custom field in the same table. | |
CUSTOM | CUSTOM(field: Field) CUSTOM("_ARIS.Case"."Case duration") | References a custom field with an identifier that is shared by the custom and a system field in the same table. |
Dynamic operator
The ARIS process language provides the following operator to retrieve data dynamically at runtime.
CASE WHEN (AFTER("_ARIS.Case"."Case end time", ADD_DAYS(NOW(), -1))) THEN 'true' ELSE 'false'
The operation returns the state of the case as true if the end date of the case is more than one day away.
TO_LONG(NOW())-TO_LONG("_ARIS.Case"."Case end time")
The operation returns the time span between the end time of the case and now as number in milliseconds.
Operator type | Subtype | Syntax | Description |
Now | - | NOW() | Retrieves a date value with the current timestamp. |
Date operators
Operator type | Subtype | Syntax | Description |
DAY | - | DAY(date) DAY('2009-07-30') | Returns the day of month of the date or timestamp. |
DAYOFYEAR | - | DAYOFYEAR(date) DAYOFYEAR('2016-04-09') | Returns the day of year of the date or timestamp. |
HOUR | - | HOUR(timestamp) HOUR('2009-07-30 12:58:59') | Returns the hour component of the string or timestamp. |
MINUTE | - | MINUTE(timestamp) MINUTE('2009-07-30 12:58:59') | Returns the minute component of the string or timestamp. |
MONTH | - | MONTH(date) MONTH('2016-07-30') | Returns the month component of the date or timestamp. |
QUARTER | - | QUARTER(date) QUARTER('2016-08-31') | Returns the quarter of the year for date, in the range 1 to 4. |
SECOND | - | SECOND(timestamp) SECOND('2009-07-30 12:58:59') | Returns the second component of the string/timestamp. |
WEEKDAY | - | WEEKDAY(date) WEEKDAY('2009-07-30') | Returns the day of the week for date or timestamp (0 = Monday, 1 = Tuesday, ..., 6 = Sunday). |
WEEKOFYEAR | - | WEEKOFYEAR(date) WEEKOFYEAR('2008-02-20') | Returns the week of the year of the given date. A week is considered to start on a Monday and week 1 is the first week with >3 days. |
YEAR | - | YEAR(date) YEAR('2016-07-30') | Returns the year component of the date or timestamp. |
Query operator
The ARIS process language provides the QUERY operator to use scripted measures in calculated fields.
The QUERY operator supports the syntax of scripted definitions for measures.
Scripted definition:
AVG("_ARIS.Case"."Case duration")
Query including the scripted definition:
QUERY(AVG("_ARIS.Case"."Case duration"))
Operator type | Subtype | Syntax | Description |
Query | - | QUERY() | Executes a single query against the data set without any filters except data access and explicitly set filters applied. The query must be static and cannot be changed based on the specific case, that is, parameters or any field value cannot be used inside the query. |
Examples
The following examples show how to use scripted definitions in calculated fields.
The examples are based on this data:
Product | Color | Activity | Costs |
|---|---|---|---|
Product A | Red | ||
Activity A | 1000 | ||
Activity B | 2000 | ||
Activity C | 3000 | ||
Product A | Green | ||
Activity A | 500 | ||
Activity B | 800 | ||
Product B | Red | ||
Activity A | 4000 | ||
Activity B | 6000 | ||
Activity C | 8000 | ||
Product C | Yellow | ||
Activity A | 1000 | ||
Product C | Yellow | ||
Activity A | 1500 | ||
Activity B | 1200 |
The script compares the process costs with the average process costs and mark them with Above average and Below average accordingly.
CASE WHEN ("_ARIS.Case"."Process costs" > QUERY(AVG("_ARIS.Case"."Process costs")))
THEN 'Above average'
ELSE 'Below average'
Case ID | Result |
|---|---|
1 | Above average |
2 | Below average |
3 | Above average |
4 | Below average |
5 | Below average |
The script compares the activity count of the case to the average activity count of all cases and mark them with Less than average activities and More than average activities.
CASE WHEN ("_ARIS.Case"."Number of activities per case" > QUERY(AVG("_ARIS.Case"."Number of activities per case")))
THEN 'More than average activities'
ELSE 'Less than or equal average activities'
Case ID | Result |
|---|---|
1 | More than average activities |
2 | Less than average activities |
3 | More than average activities |
4 | Less than average activities |
5 | Less than average activities |
SUM (Number of cases) | Result |
|---|---|
2 | More than average activities |
3 | Less than average activities |
Count rework operator
The ARIS process language provides the count rework operator for performing rework analyses.
Operator type | Subtype | Syntax | Description |
Count rework | - | COUNT_REWORK(filter?: Boolean) | Counts how many activities match the provided filter condition (defaults to counting all activities). Returns a value of the Number type (integer). |
COUNT_REWORK("_ARIS.Activity"."Activity Name" = 'Send invoice' OR "_ARIS.Activity"."Activity Name" = 'Send corrected invoice')
Pull-up operators
Pull-up operators allow to aggregate a new field based on the field values of superior or subordinate objects by traversing the object (instances) hierarchy structure.
Activity operators
The ARIS process language provides various activity operators.
The SUCCESSOR and PREDECESSOR operators to retrieve data from subsequent or preceding activities in a sequence of activities.
Special rework operators for performing rework analyses.
Filter operators
The ARIS process language provides several filter operators to define calculated fields and code filters.