The Deliver tool features two tools to conditionally display text within a message. The first, conditional logic, can be accessed by clicking the if icon. To use conditional logic:
- Highlight the text to be conditionally displayed.
- Click the if icon.
- Specify the conditions for showing the text.
- Click Ok.
While conditional logic is useful for making simple comparisons, Liquid markup excels at simple to complex comparisons that show/hide a few words to entire paragraphs and even images.
Something to also note is that there is a slight variation in how conditional logic and Liquid markup appear when viewing the message:
Evaluations can be updated by double clicking on the highlighted statements. However for Liquid markup, we recommend writing and editing directly within the source of the message. This will allow for more complex evaluations and easier upkeep.
TipLiquid markup cannot parse ampersands in strings. Using special characters like "&" should be avoided if possible.
Use Liquid markup to compare a merge field against a static value or another merge field to conditionally show information. Evaluations are initiated with thetag and closed with the tag:
Thetag allows for multiple comparisons:
Thetag will return a value if all prior evaluations were FALSE. This is useful when displaying a generic message:
|assign||Assigns a value to a variable|
|capture||Captures and assigns a value to a variable|
An efficient method of comparing a variable against multiple conditions
|for||Loops through a range, which can be an array|
|if/elsif||Determines if one value is equal to another value|
|unless||Reverse of an if statement|
Different kinds of comparisons can be made by adjusting the operator:
|==||Determines if one value is equal to another value|
|!=||Determines if one value is not equal to another value|
|>, >=, <, <=||
Determines if one value is:
|contains||Determines if one value contains another value|
Multiple comparisons can be made in the same evaluation using the and & or Boolean operators:
|and||Determines if both comparisons are true||
|or||Determines if one or both comparisons are true|
Standard filters allow you to modify content in merge fields:
|date||Formats a date||
|divided_by||Divides two numbers||
|downcase||Sets all letters to lowercase||
|first||Returns the first element of an array|
|last||Returns the last element of an array||
|minus||Subtracts two numbers|
|modulo||Returns the remainder after division||
|plus||Adds two numbers|
|replace_first||Replaces the first occurrence of a match|
|size||Returns the number of elements in an array or number of characters in a string||
|snippet||Allow you to pass in a value and output a snippet.|
|split||Splits a string into an array on a matching criteria|
|strip_html||Removes HTML tags from a string|
|times||Multiples two numbers||
|uniq||Dedupes values in an array|
|upcase||Sets all letters to uppercase|
Helper variables are useful for assessing properties of a for loop:
|forloop.length||Length of the loop|
|forloop.index||Number of current loop iteration|
|forloop.rindex||Number of remaining loop iteration(s)|
|forloop.first||Determines if the current iteration is the first iteration|
|forloop.last||Determines if the current iteration is the last iteration|