Get started with Helper functions

Use Journey Optimizer templating language to perform operations on data, such as calculations, data formatting or conversions, conditions, and manipulate them in the context of personalization. Learn personalization syntax guidelines in this page.

➡️ Learn how to use helper functions in this video

Templating language is leveraged in helper functions available in personalization drop-down list of the Expression editor, as below:

In the Journey Optimizer Expression editor, helper functions are grouped into three categories: Functions, Helpers and Operators.

Select a category, to access sub-categories and functions.

Access to sub-categories by clicking the > icon. Select a function by clicking on the + icon: the function is automaticaly added to the personalization screen.

Click the ... icon to view the description of the function and add it to your favorites. Learn more

Functions

Aggregation and Array Functions

AverageThis function returns the arithmetic mean of all the selected values within the array
CountThis function returns the number of elements within the given array
Count Only NullThis function counts the number of null values in the list.
Count With NullThis function counts all the elements of the list including null values
DistinctThis function gets values from an array or a list with duplicate values removed
Distinct Count With NullThis function counts the number of different values including the null values
First itemThis function returns the first item in an array or a list
First n in arrayThis function returns the first `N` items in an array, when sorted in ascending order based on the given numerical expression
InThis function is used to determine if an item is a member of an array or list
IncludesThis function determines if an array or list contains a given item
IntersectsThis function determines if two arrays or lists have at least one common member
Last n in arrayThis function returns the last `N` items in an array, when sorted in ascending order based on the given numerical expression
MaximumThis function returns the largest of all the selected values within an array
MinimumThis function returns the smallest of all the selected values within the array
Not inThis function determines if an item is not a member of an array or list
Subset ofThis function determines if a specific array (array A) is a subset of another array (array B), i.e. if all elements in array A are elements of array B
SumThis function returns the sum of all the selected values within the array
Superset ofThis function determines if a specific array (array A) is a superset of another array (array B), i.e. if that array A contains all elements in array B

Date Time Functions

AgeThis function retrieves the age from a given date
Current time in millisecondsThis function retrieves current time in epoch millisecond
Date differenceThis function retrieves the difference between two dates in number of days
Day of weekThis function retrieves the day of week
Day of yearThis function retrieves the day of year
Format dateThis function formats a date time value
Set DaysThis function sets the day of the month for the given date-time
Set HoursThis function sets the hour of the date-time
To UTCThis function converts a datetime to UTC
Week of yearThis function returns the week of the year

Map Functions

GetThis function is used to retrieve the value of a map for a given key
KeysThis function is used to retrieve all the keys for a given map
ValuesThis function retrieves all the values of a given map

Math Functions

AbsoluteThis function converts a number it's absolute value
RandomThis function returns a random value between 0 and 1
Round downThis function rounds down a number
Round upThis function rounds up a number
To percentageThis function converts a number to percentage
To precisionThis function converts a number to required precision

Object Functions

Is not nullThis function is used to determine if an object reference exists
Is nullThis function is used to determine if an object reference does not exist

String Functions

Camel CaseThis function is used to capitalize the first letter of each word of a string
ConcatThis function is used to combine two strings into one
ContainsThis function is used to determine if a string contains a specified substring
Does not containThis function is used to determine if a string does not contain a specified substring
Does not end withThis function is used to determine if a string does not end with a specified substring
Does not start withThis function is used to determine if a string does not start with a specified substring
Encode 64This function is used to encode or decode a string
Ends withThis function is used to determine if a string ends with a specified substring
EqualsThis function is used to determine if a string does not start with a specified substring, with case sensitivity
Equals Ignore CaseThis function is used to determine if a string does not start with a specified substring, without case sensitivity
Extract Email DomainThis function is used to extract the domain of an email address
Get url hostThis function is used to get url host.
Get url pathThis function is used to get url path
Get url protocolThis function is used to get url protocol
Index OfThis function returns the position (in the first argument) of the first occurrence of the second parameter. Returns -1 if there is no match
IsEmptyThis function is used to check if a string or expression is empty.
Is Not EmptyThis function returns true if the string in the parameter is not empty.
Last Index OfThis function returns the position (in the first argument) of the last occurrence of the second parameter. Returns -1 if there is no match.
Left trimThis function removes white spaces from beginning of a string
LengthThis function is used to get the number of characters in a string or an expression
LikeThis function is used to determine if a string matches a specified pattern
Lower CaseThis function converts a string to lower case letters
MaskThis function is used to replace a part of a string with "X" characters.
MatchesThis function is used to determine if a string matches a specific regular expression
MD5This function returns md5 hash of input string.
Not equal toThis function is used to determine if a string is not equal to the specified string
Not Equal With Ignore CaseThis function compares two strings ignoring case.
Regular expression groupThis function is used to extract specific information, based on the regular expression provided
ReplaceThis function replaces a given substring in a string with another substring
Replace allThis function replaces all substrings of a text that matches the "target" with the specified literal "replacement" string
Right trimThis function removes white spaces from end of a string
SplitThis function is used to split a string by a given character
Starts withThis function is used to determine if a string starts with a specified substring
String to dateThis function is used to convert string to date. It returns the epoch date as output for invalid input.
String to integerThis function Converts a string value into an integer value.
String to numberThis function is used to convert a string into number. It returns the same string as output for invalid input.
Sub stringThis function returns the sub-string of the string expression between the begin index and the end index.
Title CaseThis function is used to capitalize first letters of each words of a string
To BoolThis function Converts an argument value into a boolean value, depending on its type.
To Date TimeThis function is used to convert string to date. It returns the epoch date as output for invalid input.
To Date Time onlyThis function converts an argument value into a date time only value.. It returns the epoch date as output for invalid input.
TrimThis function removes white spaces from the beginning and from end of a string
Upper caseThis function converts a string to upper case letters
Url decodeThis function is used to decode a url encoded string.
Url encodeThis function is used to url encode a string.

Helpers

Helpers are detailed in this page.

Default fallback valueThis function allows to render a variable with default
EachThis function is used to iterate over an array
IfThis function is used to define a conditional block - if the expression evaluation returns true, the block is rendered
LetThis function allows an expression to be stored as a variable to be used later in a query
UnlessThis function is used to define a conditional block - if the expression evaluation returns false, the block is rendered
WithThis function is used to change the evaluation token of template-part

Operators

Arithmetic functions

Arithmetic functions are used to perform basic calculations on values.

AdditionThis operator is used to find the sum of two argument expressions
DivideThis operator is used to find the quotient of two argument expressions
MultiplicationThis operator is used to find the product of two argument expressions
Remainder This operator is used to find the remainder after dividing the two argument expressions
Subtraction This operator finds the difference between two expressions

Boolean functions

Boolean functions are used to perform boolean logic on different elements.

AndThis operator creates a logical conjunction
OrThis operator creates a logical disjunction

Comparison functions

Comparison functions are used to compare between different expressions and values, returning true or false accordingly.

EqualsThis operation checks if values are equal
Greater thanThis operator checks if first value is greater than the second value
Greater or equals toThis operator checks if first value is greater than or equal to the second value
Less than or equals to This operator checks if first value is smaller than or equal to the second value
Not equals toThis operator checks if given expression not equal to give value

How-to video

Learn how to transform personalization values using personalization helper functions and understand different use cases for helper functions.

On this page