Operators operators
Boolean functions boolean-functions
Boolean functions are used to perform boolean logic on different elements.
And and
The and function is used to create a logical conjunction.
Syntax
{%= query1 and query2 %}
Example
The following operation will return all people with home country as France and birth year of 1985.
{%= profile.homeAddress.country = "France" and profile.person.birthYear = 1985 %}
Or or
The or function is used to create a logical disjunction.
Syntax
{%= query1 or query2 %}
Example
The following operation will return all people with home country as France or birth year of 1985.
{%= profile.homeAddress.country = "France" or profile.person.birthYear = 1985 %}
Comparison functions comparison-functions
Comparison functions are used to compare between different expressions and values, returning true or false accordingly.
Equals equals
The = (equals) function checks whether one value or expression is equal to another value or expression.
Syntax
{%= expression = value %}
Example
The following operation checks if the home address country is France.
{%= profile.homeAddress.country = "France" %}
Not equal notequal
The != (not equal) function checks whether one value or expression is not equal to another value or expression.
Syntax
{%= expression != value %}
Example
The following operation checks if the home address country is not France.
{%= profile.homeAddress.country != "France" %}
Greater than greaterthan
The > (greater than) function is used to check if the first value is greater than the second value.
Syntax
{%= expression1 > expression2 %}
Example
The following operation defines people born strictly after 1970.
{%= profile.person.birthYear > 1970 %}
Greater than or equal to greaterthanorequal
The >= (greater than or equal to) function is used to check if the first value is greater than or equal to the second value.
Syntax
{%= expression1 >= expression2 %}
Example
The following operation defines people born in or after 1970.
{%= profile.person.birthYear >= 1970 %}
Less than lessthan
The < (less than) comparison function is used to check if the first value is less than the second value.
Syntax
{%= expression1 < expression2 %}
Example
The following operation defines people born before 2000.
{%= profile.person.birthYear < 2000 %}
Less than or equal to lessthanorequal
The <= (less than or equal to) comparison function is used to check if the first value is less than or equal to the second value.
Syntax
{%= expression1 <= expression2 %}
Example
The following operation defines people born in 2000 or before.
{%= profile.person.birthYear <= 2000 %}
Operations with numbers
Template Migration Functions template-migration-functions
Template Migration Functions are available in the personalization editor to assist with migrating existing templates to Journey Optimizer.
Compare via operator amp-compare
The ampCompare function compares two values using the specified comparison operator.
Syntax
{%= ampCompare(value1, value2, operator) %}
value1value2operatorExample
{%= ampCompare(profile.person.age, 18, 4) %}
Substring range amp-substr
The ampSubstr function returns a portion of a string between the specified start and end indices.
Syntax
{%= ampSubstr(string, startIndex, endIndex) %}
stringstartIndexendIndexExample
The following expression returns the first five characters of the string “Hello World”.
{%= ampSubstr("Hello World", 0, 5) %}
Returns Hello.
Compare To compare-to
The compareTo function compares two strings lexicographically. It returns a negative integer if the first string comes before the second, zero if they are equal, or a positive integer if the first string comes after the second.
Syntax
{%= compareTo(string1, string2) %}
string1string2Example
{%= compareTo("apple", "banana") %}