Functions apply additional processing or formatting to the data returned by the expression and can be divided into the following categories:

String functions

The following functions can only be applied to text outputs.

ExpressionDescription
.indexOf('text')Returns the zero-based position of the first occurrence of text. Returns -1 if not found.
.leading(x, 'char')Pads the beginning with char until the string reaches length x.
.left(x)Returns the first x characters.
.replace('old', 'new')Replaces the first occurrence of old with new.
.reverse()Reverses the string.
.right(x)Returns the last x characters.
.substring(x, y)Extracts y characters starting at index x.
.toLower()Converts to lowercase.
.toUpper()Converts to uppercase.
.trim()Removes leading and trailing whitespace. Does not affect spaces inside the text.
InputResult
{'abcdef'.indexOf('d')}3
{'a'.leading(4,'0')}000a
{'123456'.left(3)}123
{'Lorem ipsum dolor.'.replace('dolor','amet')}Lorem ipsum amet.
{'123456'.reverse()}654321
{'123456'.right(3)}456
{'123456'.substring(3,2)}45
{'AAA'.toLower()}aaa
{'aaa'.toUpper()}AAA
{' Lorem ipsum dolor. '.trim()}Lorem ipsum dolor.

Mathematical functions

The following functions can only be applied to numeric outputs.

ExpressionDescription
.add(x)Adds x to the value.
.subtract(x)Subtracts x from the value.
.divide(x)Divides the value by x.
.modulo(x)Returns the remainder of the value divided by x.
.multiply(x)Multiplies the value by x.
.power(x)Raises the value to the power of x.
.round()Rounds to the nearest whole number.
.round(x)Rounds to x decimal places.
.floor()Rounds down to the nearest whole number.
.ceiling()Rounds up to the nearest whole number.
.format('formatstring')Formats the value using a C# format string. See Microsoft docs on standard and custom numeric format strings.
.format('formatstring', 'culture')Formats the value using a C# format string and culture identifier.
InputResult
{'1'.add(2)}3
{'3'.subtract(1)}2
{'1'.divide(10)}0.1
{'12'.modulo(10)}2
{'2'.multiply(3)}6
{'2'.power(3)}8
{'2.0127'.round()}2
{'2.0127'.round(3)}2.013
{'2.555'.floor()}2
{'2.002'.ceiling()}3

Datetime functions

Datetime functions can only be applied to time-based attributes and variables, such as timestamps or dates, e.g.:

  • {currentObject.attribute('last_updated').addDays(31)} — adds 31 days to the specified date.
  • {currentUtcDate.addDays(31)} — adds 31 days to today.
ExpressionDescription
.addSeconds(x)Adds x seconds.
.addMinutes(x)Adds x minutes.
.addHours(x)Adds x hours.
.addDays(x)Adds x days.
.addMonths(x)Adds x months.
.addYears(x)Adds x years.
.addWorkingDays(x, 'country')Adds x working days. Use a three-letter country code (e.g., USA, GBR) to determine which working-day calendar is used.
.format('formatstring')Formats the datetime using a C# format string. See Microsoft docs on standard and custom date/time format strings.

Global functions

Global functions are used independently of any specific object or array. They build text dynamically by combining strings and expressions. Used inside function chains, most commonly within .forEach().

Global functions take two parts:

  • 'string' — the base text. Can include numbered placeholders ({0}, {1}, …) that are replaced by the expressions that follow.
  • *params — one or more expressions providing values for the placeholders. The first expression replaces {0}, the second replaces {1}, and so on.
ExpressionDescription
append('string', *params)Adds the text to the result without a trailing newline.
appendLine('string', *params)Adds the text to the result with a trailing newline.
ExpressionResult
append('{0} - {1}', x.name(), x.attr('core_description'))Object 1 - Description text
appendLine('{0} - {1}', x.name(), x.attr('core_description'))Object 1 - Description text + newline

Full example combining global and array functions:

{currentObject}.children().forEach(x => appendLine('Object: {0}, Steward: {1}', x.name(), x.userRelation('core_steward').name()))

Array functions

Functions that operate on lists of objects, such as those returned by .children() or .relations() selectors. They let you iterate through multiple items.

ExpressionDescription
.forEach(variable => function chain)Applies an action to every object in the array. variable represents a single object from the array (e.g., x). The function chain defines the operations to perform on that object and can include global functions.
ExpressionResult
.forEach(x => x.name())Object1 Object2 Object3
.forEach(x => appendLine(x.name()))Object1<br>Object2<br>Object3