This page details the use of operands and dynamic tags to allow for blocks of text to be hidden or displayed based on the evaluation of statements.


Dynamic Text Blocks and Operands

Using selected operands, you can create dynamic text blocks that will appear or not appear in an email based on whether or not dynamic variables match expected values on an individual's user record. For example, you could write a dynamic block that would have an email open with "Dear [first name]" if there is a subscriber.firstname value for the subscriber, and "Dear Customer" if there is no subscriber.firstname value.


Dynamic HTML Tags - Reminder

As stated elsewhere, dynamic block statements should be surrounded by HTML <dynamic> tags:




This will prevent the HTML editor used for emails and templates from formatting the dynamic content as regular HTML content. Dynamic content blocks, therefore, only appear in the HTML source view of an email or in the editable section of an email Template.

Scripts will work and process without the <dynamic> tags, but they may display incorrectly in the WYSIWYG HTML editor.


If/Else Statements and Operands

If Statement Structure and Syntax

Query and comparison arguments are perhaps one of the most commonly used methods of building conditional statements. These usually take the form of if/else statements. With an if/else statement you can check the value returned by a dynamic variable and respond accordingly.

The dynamic scripting structure for if/else statements requires starting with an if statement.

The if itself must be followed by the query (variable, operand, and value), then the closing asterisk and bar, such as:  |*if [variable] [operand] [value]*|

An example of this syntax would be:
|*if subscriber.attributes.company = Questline*|

We start with an if, then proceed with the variable subscriber.attributes.company, the equals sign operator, and the value Questline. We are starting this example conditional statement block by saying "If the email recipient's company value is Questline, then..." - and we'll follow up after the if statement with the results.

Dynamic variables within the if statement do not need their own|* ... *|signs. The variable being queried or compared to does not require quotes around it, and is case insensitive unless being used in a Contains/Does Not Contain statement.

 The scripting language allows for both else and elseif statements, allowing the user to have two or more conditional results available. All statements must end with an |*endif*| statement.

It is not necessary to put each dynamic statement on its own line in the HTML code, but this is not necessary for the script to work properly. After the query, expected actions should be on their own rows, however.

If/else statements follow a similar to stricture to if/then/else statements in other languages.


The format in Questline's scripting language is essentially:

|*if [condition] *|

[action - without an explicit "then"]

|*else [action]*|




The operands available for queries are:

= or == (equal to)

<> or != (not equal to)

> (greater than)

< (less than)

>= (greater than or equal to)

<= (less than or equal to)

|> (starts with - case insensitive)

<| (ends with - case insensitive)

~ (contains)

!~ (does not contain)



Comparisons are run against Text, Number, Boolean, or Date values. When being called or checked with an operand, all values are automatically viewed as strings, with the exception of using > or < with numbers.

There is no longer a need for specific Type Checks.


Check if Blank or Empty

A common need is to determine whether or not a variable has a value at all for a subscriber. For example, you may need to determine whether or not the variable subscriber.firstname is blank in order to decide whether or not to say Dear [first name] in an email or Dear Customer.

To do this, compare the variable to an empty string as in these examples:

|*if subscriber.firstname = ""*|

|*if subscriber.firstname != ""*|

|*if subscriber.firstname <> ""*|

These comparisons will return a True or False result. This can be used in scripting as shown in Basic Email Scripting Examples.


Expressions for Queries

Within a query, a user can use specific operands to add layers of complexity to the query.

Queries with expressions still fall within an |*if  ...  *| statement, but allow for combining more than one dynamic variable/value.

Expressions for queries include:





Only one and and one or is allowed in an expression. There is no nesting of and/or expressions allowed.


Email Preview Screen and Errors

When attaching an email with conditional scripting to a Campaign Send, should send a test email in the context of a subscriber - or send a test campaign send - t to see if the query works properly.

An email attached to a campaign can be previewed in the context of a selected subscriber. Once an email is attached to the send, you can choose the Email Preview function from the 3rd step of the Send wizard. You can enter part of an email address belonging to a subscriber on the campaign, and select from a list of results. The email will then display any dynamic content in the preview as if the email had been sent to that subscriber. Again, if the dynamic script is not set up correctly, you may see incorrect text or even an error.

These topics are covered in greater detail in Creating Emails and Templates with Dynamic Scripting, under the heading "Testing Your Dynamic Content".