An expression is basically the data or output you’d like to show in your message.
A simple example looks like this:
{{ this is an expression }}
An expression can be a combination of many things.
For example, it can be:
- Constant - Something fixed, like the exact date when a voucher expires.
- Variable - Each customer’s first name. ESL returns a value once you give it an expression.
{{ Contact.1 }}
In ESL, expressions are enclosed within {% %} delimiters, like if/else statements. The following expression, using if/else statements within special characters {% %}, retrieves the value of the contact.1 field:
{% if contact.1 %}Hello {{ contact.1 }}! {% else %} Welcome! {% endif %}
This is how the expression will look like without using else:
{% if contact.1 %}Hello {{ contact.1 }}! {% endif %}
Expressions in the VCE editor
In our example screenshots, the name "Tamás" is displayed as the result when the statement is true for contact.1. If contact.1 does not return any value (i.e., the statement is false), your user will either see no value displayed or only receive the 'Welcome!' greeting when the else statement is used.
This is how the ESL snippets looks when added to the VCE editor:
Contact Preview shows you how the ESL snippets look for your user. In case both statements return a value for contact.1 your user will see the following:
In case the statement was false, your user will have no value returned in the first example used without else.
In the second example, your user should see only the ‘Welcome’ greeting as per below: