A filter is a particular rule for an ESL expression. To put it simply, you can modify the value of a variable when using it, but the actual value remains the same.
To apply a filter in an expression use the |
pipe character.
Using a fallback text: First name vs friend
For example, in case you do not have the customer’s first name, you can display a fallback text by using the default filter. If the first name field has no value in our database, display the text "friend" instead.
The code looks like this.
{{ Contact.1|default('friend') }}
Fallback text in the VCE editor
This is what you can see when using a fallback text in the VCE editor:
This is how the ESL snippet appears in the Contact Preview, displaying what your user could see:
If you would like to have more filters for one ESL expression in your HTML-based email, you can combine them easily. To show the value in uppercase and still have a fallback text, enter the following ESL code:
{{ Contact.1|default('friend') | upper}}
This is how it looks in the VCE editor:
This is the result what your users can see in the Contact Preview:
A little syntax recap for you:
{{ this is an expression }}
{% this is a statement %}
|this is a filter