Dynamic content

Purpose group:E-mail template builders

In Ternair Campaign, the content of e-mails (and SMS messages) 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 truncated. This means that leading and/or trailing spaces are automatically removed. For parameters, this technique is not applied.

  • Values are NOT case-sensitive.

  • The use of newlines (enters) is possible.

  • A field can contain all characters, except [ ] / | \


Examples


Display a value


Variables are enclosed in parentheses [<value>].
It is important to always open and end (close) the syntax.
Use a backslash (\) to prevent replacing the variable.

Example

Result

My name is [first name]

My name is John

My name is [first name]

Disregarding syntax

My name is John [last name]

Substituting one or more values
When substituting one or more values, an "if" and an "else" are required. 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|=V|Ms,]

- When value gender is V

Best Mrs,

- Otherwise

Best Sir,

Dearest [gender|=V|Mrs.,

- When value gender is V

Dear Mrs,

- When value gender is M

Dear sir,

- Otherwise

Dear visitor,

Dear [gender|=V|mom],

Space in text

- When value gender is V

Best Mrs,

- Otherwise

Best , (including space)

Best[gender|=V| Mrs.],

Space in parameter

- When value gender is V

Best Mrs,

- Otherwise

Beautiful, (without space)

Beautiful [gender|=V|

Ms,]

Use of enters (break) is allowed

- When value gender is V

Dearest

Madam,

My name is [name|John [name|Jonny] Doe].

Two syntaxes in one variable

My name is John Jonny Doe


Display or replace information based on an empty field or value

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.

- Otherwise

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.

- Otherwise

Receive a free cup of coffee.


Replace one or more values with HTML

A value can also be replaced with HTML.

In a template, this is used as follows:
[<field>|<operator>|<if-case>|<else-case>]

Example

Result

[Gender

|=V|

<div style="color:#febeff"><strong>Need new shoes?</strong><br />Stop by and get 10% off!</div>

|=M|

<div style=" color:#9ef0ff"><strong>We also have men's clothing</strong><br />Come by and get 10% off!</div>

|

<div style=" color:#085500;"><strong>10% Discount</strong><br />Come see our new collection!</div>]

- When value gender is V

Need new shoes?

Come by and get 10% off!

- When value gender is M

We also have men's clothing

Come by and get 10% off!

- Otherwise

10% Discount

Come see our new collection!


Replace number with value

When replacing a number, a comparison operator can be used (=, <>, <, <=, >=).
Replacing a number works the same way as replacing a value:
[<field>|<operator>|<if-case>|<else-case>]

The if-else construction is always an OR. It cannot occur 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 the value age is under 18

I am young

- Otherwise

I am old

I am [Age|<18|young|>=67|retired|an adult]

- If the value age is younger than 18

I am young

- If the value age is 67 or older

I am retired

- Otherwise

I am an adult

I am [Age|<12|is in elementary school|<23|study|an adult]

- If the value age is under 12

I am in elementary school

- If the value age is under 23 but not under 12

I am studying

- Otherwise

I am an adult

[birthday|<01011990|You're old enough|You're too young]

- If the value birthday is before 01-01-1990

You're old enough

- If the value birthday is after 01-01-1990

You're 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|lord/madam],

- Value first name is John

Dear John,

- When value first name is empty

Dear Sir/Madam,


Text formatting

Ternary supports the following formatting. Namely lowercase, wordcase, Currency and Replace:
It is also possible to place a variable inside another variable.

Function

Preview

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

[first name|$|wordcase], receive a free cup of coffee.

- hans

Hans, receive a free cup of coffee.

Value

Receive a free cup of coffee worth €[price|$|currency]

Receive a free coffee maker worth.worth €[price|$|currency]

- 2.5

Receive a free cup of coffee worth €2.50- 1250

Receive a free coffee machine t.v. €1,250

Replace

[Salutation|$|replace|Dhr.|The Lord|Mrs.|Ms.] [insertion] [last name], receive a free cup of coffee.

- Mr. de Boer

Mr. de Boer, receive a free cup of coffee.

Date

[Date of birth|$|date|dd - MM - yyyy]

-

28 - 01 - 1987

Formattingdate, AND culture

[Date of birth AND|$|date|and|dd - MM - yyyy]

-

28 - 01 - 1987

Formattingdate with textt

[Date of birth|$|date|dayname, day - month - year]

-

Woe, 28 - 01 - 1987

Trim

[first name|$|trim], receive a free cup of coffee.

- Hans

Hans, receive a free cup of coffee.

FirstCharUp

[firstname|$|trim], receive a free cup of coffee.[firstname|$|FirstCharup], receive a free cup of coffee.

- HANS

Hans, receive a free cup of coffee.


Reference to other fields

Within a variable, a reference or comparison can be made to another field.
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 place a variable inside another variable.

Example

Result

My name is [nickname|@firstname@]

My name is John

My age is equal to my gender: [age|=@sex@|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 equal to my gender: this is incorrect

[age |<18|you are @age@ years old, unfortunately this is too young|>55|You are @age@ and exceed the maximum age of 55|Your age of @age@ is between the age limits].

- If age is 17

You are 17, unfortunately this is too young

- If value age is 25

Your age of 25 is between age limits

- If value age is 59

You are 59 and exceed the maximum age of 55

[eventlist|=TernairMasterClass

|<p>Dear [gender|=M|lord|=V|mom|visitor],</p><p>Great that you are coming to 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 is M and active on event list with value TernairMasterClass

Dear Sir,

Wonderful that you are coming to the Ternair MasterClass.

- If value gender is M and not active on event list with value TernairMasterClass

Dear Sir,

The Ternair MasterClass is in January, please buy your ticket now.


Display Lists

There are five ways to display a list.
In a template, it 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 begins with

<between>

= Value between list items

<betweenlast>

=show this between last two values

<after>

= List item ends with

<empty>

= This value is displayed when a list contains no values


It is possible to return HTML from a variable.

Example

Result

We operate in the industries [industry list|@|,]

Based on: [field|@|<between>]

- Show values separated by,

We are active in the industries Accountancy, Tax Law, Prudential Consulting, Quality Management

This week there are [activity list|@| | | |no activities available]

Based on: [field|@|<before>|<after>|<empty>]

- Show when no value is 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>|pressive days.]

Based on: [field|@|<before>|<between>|<betweenlast>|<after>|<empty>]

- Show value in a list

Our work week consists of

  • Monday,

  • Tuesday,

  • Wednesday &

  • Thursday

- Show when no value is available

Our work week consists of busy days.


Split lists

A string, column or field can contain multiple values separated by a splitter. 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.

  • Splitters are: \, \; \_ \- \. \tab

  • @ = Show all values


Example

Result

Our baker sells [stock,|@|and ]

- Show a list separated by,

Our baker sells white bread, whole wheat bread, rye bread and multigrain bread


Show a single item from a list

It is possible to show a single value from a list.

In a template, this is used as follows:
[<field>|#|<index>]

  • # = Show one value

  • <index> = Represents one item in the list

    Index 1 is the first value, index 2 is the second value, index 3 is the third value, and so on.


Example

Result

The preparations began in [list of months|#|1]

- Show first value of list

Preparations began in January

The event will take place in [list of months|#|3]

- Show third value of the list

The event will take place in March


List contains a value

A text can be displayed 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 [Game list tab

|=level1|this game just bought

|=level2|this game half played

|=level3|this game almost played

|this game not yet played

].

- If the Game ListTab value is level 3

I have almost finished this game.

- If no values are available

I have not played this game yet.


Value occurs IN (if A or B then xxx)

It is possible to display 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 with the separator placed after the value.
For example: [field|in@<value>;<value>;<value>|<if-case>|<else-case>]

Preview

Result

Best visitor, <br/>

[Status|in@ordered;shipped;on its way;

|

Your order is being processed

|

Finalize your order quickly and take advantage of our special offers

].

- If value status has been sent

Dear visitor,

Your order is being processed.

- As value status is shopping

Best visitor,

Finish your order quickly and take advantage of our special offers.


Operators

Available Operators

Comparison operator

Symbol

Significance

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 less than or equal to

A1<=B1

<>

Is not equal to

A1<>B1

Is empty

Is empty

Is not empty

Is Not Empty

In

In


Unavailable operators

Arithmetic operators and reference operators are not available.

Variables

Please note

  • Variables are not case sensitive.

  • 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 bock

Export block

Settings

Global settings

Variable

E-mail body

Export file

folder name

confirmation email

Tags

Trackers

Landing page

~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~





Copyright © 2025 Ternair.