Editing an expression involves manually entering conditions to form a rule.
This mode allows you to use advanced functions. These functions let you manipulate the values used to carry out specific queries such as manipulating dates, strings, numerical fields, sorting, etc.
It is also possible to use workflows’ events variables when editing expression. For more on this, refer to the Customizing activities with events variables section.
You can edit expressions in order to:
Define a query, via the Advanced mode option which is available when a rule is added.
Edit an expression in a workflow. For example, to add additional data to an activity.
Edit a visibility condition to define how a block in the HTML content editor is displayed. In this case, the expression is edited in JavaScript format and does not offer the use of advanced functions as standard.
Advanced expression edition lets you manually define an expression that corresponds specifically to your needs.
Editing expressions can be used in the Audience window while creating an email or in a Query activity while creating a workflow.
Access the expression editing window via one of the methods detailed in the About advanced expression editing section. It involves the following elements:
Edit the expression by entering an expression directly in the corresponding field or by using the lists of available fields and functions.
Double clicking a field or an expression adds it to the expression in which the cursor is placed.
It is possible to use workflows’ events variables to build an expression. For more on this, refer to the Customizing activities with events variables section.
Give your rule a specific name if needed. The name entered will appear as the rule name in the query editor workspace.
Editing an expression lets you personalize the Audiences expression to target your population as needed.
Related Topics:
The standard expressions are made up of one or several conditions that respect the following syntax elements:
Each condition takes the form of <value1> <comparison operator> <value2> whereby:
The <value1> and <value2> type data must be identical. For example, if <value1> is a date, then <value2> must also be a date.
If you would like to use several conditions, they can be combined using logical operators.
For example:
Year(@created) = Year(GetDate()) AND Month(@created) = Month(GetDate())
In this example, the profiles whose creation date is in the current month and year are targeted.
When defining the visibility conditions of a text type block of the HTML content editor, you must use an expression with JavaScript type syntax.
JavaScript expressions are made up of one or multiple conditions, and they use the following syntax elements:
Each condition takes the form of <context> <comparison operator> <value2> whereby:
The <context> and <value2> type data must be identical. For example, if <context> is a date, then <value2> must also be a date.
If you would like to use several conditions, they can be combined using logical operators.
For example:
context.profile.age > 21 && context.profile.firstName.length() > 0
In this example, profiles older than 21 years of age and whose first name has been provided (symbolized by the fact that the firstName field contains at least one character).
For some rules, the query editor lets you chose a value to define your condition.
Conditions must be linked to values by using one of the following operators.
Operator |
Standard syntax |
JavaScript syntax |
Description |
Example |
---|---|---|---|---|
Equal to |
= |
== |
The first value must be completely identical to the second value. |
@lastName = Martin retrieves profiles whose last name is 'Martin', with only these identical characters. |
Greater than |
> |
> |
The first value must categorically be more than the second value. |
@age > 50 retrieves profiles who are older than '50', so '51', '52', etc. |
Less than |
< |
< |
The first value must categorically be less than the second value. |
@created < DaysAgo(100) retrieves all profiles created in the database less than 100 days ago. |
Greater than or equal to |
>= |
>= |
The first value must be more than or equal to the second value. |
@age >= 30 retrieves profiles aged 30 years and older. |
Less than or equal to |
<= |
<= |
The first value must be less than or equal to the second value. |
@age <= 60 retrieves profiles aged 60 or less. |
Different |
!= |
!= |
The first value must be different from the second value. |
@language != English retrieves profiles that have not been defined as English speaking. |
Contains |
IN |
N/A |
The first value must contain the second value. |
@domain IN mail. Here, all the domain names with the 'mail' value are returned in the result. Consequently, the 'gmail.com' domain name will make up part of the returned results. |
Like |
LIKE |
N/A |
Like is very similar to the Contains operator. It lets you insert a % wild card character in the value that is being searched. |
@lastName LIKE Mart%n. Here, the substitution character % serves as a "joker" to find the name "Martin" in the hypothetical case that the spelling is not correct. |
Not like |
NOT |
N/A |
Is similar to Like. It lets you not recover the entered value. Here too, the entered value must contain the % wild card character. |
@lastName NOT Smi%h. Here, the recipients correspond to the name 'Smi%h' (so Smith, etc.) are not returned as a result. |
Is empty |
IS NULL |
N/A |
The first value must correspond to an empty value. |
@mobilePhone IS NULL retrieves all the profiles whose mobile phone number has not been provided. |