Target group: Email template builders
In Ternair Marketing Cloud email (and text message) content can be personalized and customized (dynamic content). Furthermore variables can be used in output blocks.
The following three options are used:
- Fields : Field name
- Operators : Operator symbol
- Parameters : Value
Important specifications:
- Fields and operators are trimmed. This means that leading and/or trailing spaces will automatically be deleted. For parameters this technique is not applied.
- Values are NOT case sensitive.
- The use of newlines (enters) is possible.
- A field can contain all except the following five characters: [ ] / | \
Examples
Showing a value
Variables are placed in between brackets [<value>].
It is important to always open and end (close) the syntax.
Use a backslash (\) to prevent the variable from being replaced.
Example | Result |
My name is [first name] | My name is John |
My name is [first name] \[last name] Ignore syntax |
My name is John [last name] |
Replace one or more values
Replacing one or more values requires an ‘if’ and an ‘else’. Using multiple if-else statements is possible.
In a template this is used as follows:
[<field>|<operator>|<if-case>|<else-case>]
Example | Result |
Dear [gender|=F|madam|sir], | — When value gender F Dear madam — Else Dear sir |
Dear [Gender|=F|madam|=M|sir|visitor], | — When value gender F Dear madam — When value gender M Dear sir — Else Dear visitor |
Dear [gender|=F|madam], Space in text |
— When value gender F Dear madam, — Else Dear , (incl space) |
Dear[gender|=F| madam], Space in parameter |
— When value gender F Dear madam, — Else Dear, (without space) |
Dear [gender|=F| madam| sir], Use of enters (break) is allowed |
— When value gender F Dear madam, |
My name is [name|John [name|Jonny] Doe]. Two syntaxis in one variable |
My name is John Jonny Doe |
Show or replace information based on an empty field or empty value
In order to replace an empty value the NOTNULL syntax is used.
In a template this can be used as follows:
[<field>|=NOTNULL|<text when field contains a value >|< text when field is empty >]
Example | Result |
[first name|=NOTNULL|[ first name], receive|Receive] a free cup of coffee. | — When value first name is known John, receive a free cup of coffee. — Else Receive a free cup of coffee. |
[first name|=NULL|Receive|[first name], receive] a free cup of coffee | — When value first name is known John, receive a free cup of coffee. — Else Receive a free cup of coffee. |
Replace one or more values with HTML
A value can also be replaced using HTML.
In a template this is used as follows:
[<field>|<operator>|<if-case>|<else-case>]
Example | Result |
[Gender |=F| <div style=”color:#febeff”><strong>Need new shoes?</strong><br />Drop by and receive a 10% discount!</div> |=M| <div style=” color:#9ef0ff”><strong>We also have men’s clothing</strong><br />Drop by and get a 10% discount!</div> | <div style=” color:#085500;”><strong>10% Discount</strong><br />Have a look at our new collection!</div>] |
— When value gender F Need new shoes? Drop by and receive a 10% discount! — When value gender M We also have men’s clothing Drop by and receive a 10% discount! — Else 10% Discount Have a look at our new collection! |
Replace number with value
When replacing a number a comparison operator can be used (=, <>, <, <=, >=).
Furthermore, replacing a number works in the same way as replacing a value:
[<field>|<operator>|<if-case>|<else-case>]
The if-else construction is always an OR. It is not possible to appear in multiple groups. When a record satisfies the first value it is excluded when checking for the second value.
Example | Result |
I am [age|<18|young|old] | — If value age is younger than age 18 I am young — Else I am old |
I am [Age|<18|young|>=67|retired|an adult] | — If value age is younger than age 18 I am young — If value age is 67 or older I am retired — Else I am an adult |
I [Age|<12|am in elementary school|<23|study|an adult] | — If value age is younger than age 12 I am in elementary school — If value age is younger than age 23, but not younger than age 12 I study — Else I am an adult |
[birthday|<01011990|You are old enough|You are too young] | — If value birthday is before 01-01-1990 You are old enough — If value birthday is after 01-01-1990 You are too young |
Replace with empty value
When a value is NULL or empty it can be replaced with a default value.
In a template this is used as follows:
[<field>|<empty>]
Example | Result |
Dear [first name|sir/madam], | — When value first name John Dear John, — When value first name empty Dear sir/madam, |
Text formatting
Ternair supports the following formats: lowercase, wordcase, Currency and Replace:
It is also possible to place a variable inside another variable.
Function | Example | Result |
Lowercase | [first name] [middle name|$|lowercase] [last name], receive a free cup of coffee. | — Hans DE Boer Hans de Boer, receive a free cup of coffee. |
Wordcase | [voornaam|$|wordcase], receive a free cup of coffee. | — hans Hans, receive a free cup of coffee. |
Valuta | Receive a free cup of coffee at a cost of €[price|$|valuta]
Receive a free cup of coffee at a cost of €[price|$|valuta] |
— 2,5 Receive a free cup of coffee at a cost of €2,50— 1250 Receive a free coffee machine at a cost of €1.250 |
Replace | [Salutation|$|replace|Mr.|Sir|Mrs.|Madam] [middle name] [last name], receive a free cup of coffee. | — dhr de Boer Sir de Boer, receive a free cup of coffee. |
Date | [DateOfBirth|$|date|dd – MM – yyyy] | — 28 – 01 – 1987 |
Formatting – date, EN culture | [DateOfBirthEN|$|date|en|dd – MM – yyyy] | — 28 – 01 – 1987 |
Formatting – date with text | [DateOfBirth|$|date|dayname, day – month – year] | — Wed, 28 – 01 – 1987 |
Trim | [firstname|$|trim], receive a free cup of coffee. | — Hans Hans, receive a free cup of coffee |
FirstCharUp | [firstname|$|FirstCharup], receive a free cup of coffee. | — HANS Hans, receive a free cup of coffee |
Referring to other fields
Within a variable a reference or comparison to another field can be made.
This is done in the same way as replacing a number or value with an if and else.
[<field>|<operator>|<if-case>|<else-case>]
It is also possible to position a variable in another variable.
Example | Result |
My name is [nickname|@first name@] | My name is John |
My age is the same as my gender: [age|=@gender@|this is correct|this is incorrect] Reference to another field in conditional-value operation |
— If age is 17 and gender is M My age is the same as my gender: this is incorrect |
[age |<18|You are @age@ years, unfortunately this is too young|>55|You are @age@ and exceed the maximum age of 55|Your age of @age@ is in between the age limits] | — If value age is 17 You are 17, unfortunately this is too young — If value age is 25 Your age of 25 is in between the age limits — If value age is 59 You are 59 and exceed the maximum age of 55 |
[eventlist|=AutoRAI |<p>Dear [gender|=M|sir|=F|madam|visitor],</p><p>Great that you are coming to visit the Ternair MasterClass.</p> |<p> Dear [gender|=M|sir|=F|madam|visitor],</p><p>The Ternair MasterClass is in January, buy your ticket now.</p>] |
— If value gender M and active on eventlist with value Ternair MasterClass Dear sir, Great that you are coming to visit the Ternair MasterClass. — If value gender M and not active on eventlist Ternair MasterClass Dear sir, The Ternair MasterClass takes place in January, buy your ticket now. |
Showing lists
There are five options for showing a list.
In a template this is used as follows:
[field|@|<between>] | [<field>|@|,] |
[field|@|<before>|<after>] | [<field>|@|<p>|</p>] |
[field|@|<before>|<after>|<empty>] | [<field>|@|<p>|</p>|no result] |
[field|@|<before>|<between>|<betweenlast>|<after>] | [<field>|@||,|&|] [<field>|@|<li>|,|&|</li>] |
[field|@|<before>|<between>|<betweenlast>|<after>|<empty>] | [<field>|@|<li>|,|&|</li>|<li>none</li>] [<field>|@|<li>|,|&|</li>|none] |
@ | = Show all values |
<before> | = List item starts with |
<between> | = Value between list items |
<betweenlast> | = Show this between the last two values |
<after> | = List item ends with |
<empty> | = This value is shown when a list does not contain values |
It is possible to return HTML from a variable.
Example | Result |
We are active in the branches [branche list|@|,] Based on: [field|@|<between>] |
— Show values divided by, We are active in the branches Accountancy, Tax Law, Prudential Advice, Quality Management |
This week there are [activity list|@| | |no activities available]. Based on: [field|@|<before>|<after>|<empty>] |
— Show when no value available This week there are no activities available. |
This week there are [activity list|@|the following activities:<br/>|,|&|.] Based on: field|@|<before>|<between>|<betweenlast>|<after>] |
— Show values This week there are the following activities: hockey, volleyball & bingo. |
Our work week consists of work week|@|<li>|,<br/>|&|</li>|busy days.] Based on: [field|@|<before>|<between>|<betweenlast>|<after>|<empty>] |
— Show value in a list Our work week consists of
— Show when no values are available |
Splitting lists
A string, column or field can contain multiple values divided by a split sign.
This column can be split in the template.
In a template this is used as follows:
[<field>\<separator>|@|<value>]
- <separator> = field name followed by a \ and a character.
- Separators are: \, \; \_ \- \. \tab
- @ = Show all values
Example | Result |
Our baker sells [stock\,|@| en ] | — Show a list separated by, Our baker sells white bread, whole-wheat bread, rye bread and multigrain bread |
Showing one item from a list
It is possible to show one single value form a list.
In a template this is used as follows:
[<field>|#|<index>]
- # = Show one value
- <index> = Represents an item in the list
Index 1 is the first value, index 2 the second value, index 3 the third value, and so on.
Example | Result |
The preparations began in [list of months|#|1] | — Show first value from the list The preparations begin in January |
The event takes place in [list of months|#|3] | — Show the third value from the list The event takes place in March |
List contains a value
A text can be shown based on the value of a string or field.
In a template this is used as follows:
[field|=<value>|<if-case>|<else-case>]
Multiple if cases can be defined, this creates an else-if effect.
Example | Result |
I have [GamelistTab\TAB |=level1|just started playing this game |=level2|finished half of the game |=level3|almost finished this game |not yet started playing this game ]. |
— If value GamelistTab is level 3 I am almost done with this game. — If no values are available I have not yet started this game. |
Value occurs IN (if A or B then xxx)
It is possible to show a text based on multiple values.
In a template this is used as follows:
[field|in@<value>\\<separator>|<if-case>|<else-case>]
Multiple values can be used, these values are separated by the separator placed after the \\. For example: [field|in@<value>;<value>;<value>\\;|<if-case>|<else-case>]
Example | Result |
Dear visitor, <br/> [Status|in@ordered;sent;in transit\\; | Your order is being processed | Finish your order quickly and take advantage of our special offers ]. |
— If value Status is sent Dear visitor, Your order is being processed. — If value Status is shopping Dear visitor, Finish your order quickly and take advantage of our special offers. |
Operators
Available operators
Comparison operator
Symbol | Means | Example |
= | Is equal to | A1=B1 |
> | Is greater than | A1>B1 |
< | Is smaller than | A1<B1 |
>= | Is greater than or equal to | A1>=B1 |
<= | Is smaller than or equal to | A1<=B1 |
<> | Is not equal to | A1<>B1 |
Non – available operators
Mathematical operators and reference operators are not available.
Variables
Note
- Variables are case insensitive
- In a selection a date field can use (refer to) the variable ~rundate~
See the table below for an overview of the available variables and where they can be used.
Email block | Export block | Settings | Global settings | ||||
Variable | Email body | Export file name | FTP directory folder name | Confirmation mail template | Tags | Trackers | Landing pages |
~BlockDescription~ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
~BlockNumber~ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
~CampaignId~ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
~CampaignCode~ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
~CampaignDescription~ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
~CampaignExternalReference~ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
~EmailSubject~ | ✓ | ✓ | ✓ | ||||
~OfferCode~ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
~SegmentCode~ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
~SelectionId~ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
~SelectionCode~ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
~SelectionDescription~ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
~SelectionExternalReference~ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
~TID~ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
- Variables can be combined with text.
Example |
~campaigncode~1 |
test_~CampaignDescription~ |