Overview


This page provides some examples of how to use complex dynamic scripting for conditionals and comparisons. In most cases, the text of each section can be pasted into an email in its entirety for modification and practice. Any notes are in bold.

 


Dynamic HTML Tags - Reminder


Remember that dynamic block statements should be surrounded by HTML <dynamic> tags:


<dynamic>


[content]


</dynamic>


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.


 


< and > Operators


Testing < and >, also tests elseif<br>


|*if Subscriber.Attributes.Integer < 20*|


Integer is < 20 ( |*Subscriber.Attributes.Integer*| )<br>


|*elseif Subscriber.Attributes.Integer > 20*|


Integer is > 20 ( |*Subscriber.Attributes.Integer*| )<br>


|*else*|


...ELSE Integer must be 20, right? ( |*Subscriber.Attributes.Integer*| )<br>


|*endif*|


 


= and != or <> Operators


Testing = with text<br>


|*if Subscriber.Attributes.company-state = "OH"*|


Company State = OH. ( |*Subscriber.Attributes.company-state*| )  <br>


|*else*|


...ELSE Company State is not OH. ( |*Subscriber.Attributes.company-state*| )<br>


|*endif*|


 


Testing <> with text ... you could use != instead of <> as well<br>


|*if Subscriber.Attributes.company-state <> "NY"*|


Company State <> NY (|*Subscriber.Attributes.company-state*|)<br>


|*else*|


...ELSE Company State is NY (|*Subscriber.Attributes.company-state*|)<br>


|*endif*|


 


Testing = with numbers<br>


|*if Subscriber.Attributes.Integer = 20*|


Integer = 20 ( |*Subscriber.Attributes.Integer*| )<br>


|*else*|


...ELSE Integer not 20 ( |*Subscriber.Attributes.Integer*| )<br>


|*endif*|


 


Testing <> with numbers<br>


|*if Subscriber.Attributes.Integer <> 20*|


Integer <> 20 ( |*Subscriber.Attributes.Integer*| )<br>


|*else*|


...ELSE Integer 20 ( |*Subscriber.Attributes.Integer*| )<br>


|*endif*|


 


>= and <= Operators


Testing >= <br>


|*if Subscriber.Attributes.Integer >= 20*|


Integer >= 20 ( |*Subscriber.Attributes.Integer*| )<br>


|*else*|


...ELSE Integer 19 or less ( |*Subscriber.Attributes.Integer*| )<br>


|*endif*|


 


Testing <= <br>


|*if Subscriber.Attributes.Integer <= 20*|


Integer <= 20 ( |*Subscriber.Attributes.Integer*| )<br>


|*else*|


...ELSE Integer 21 or more ( |*Subscriber.Attributes.Integer*| )<br>


|*endif*|


 


IF and ENDIF without ELSE


Testing If Without Else<br>


|*if Subscriber.Attributes.company-state = "AZ"*|


Company State = AZ.<br>


|*endif*|


If nothing appeared there, State was not AZ.<br>


 


IF and ELSEIF


Testing < and >, also tests elseif<br>


|*if Subscriber.Attributes.Integer < 20*|


Integer is < 20 ( |*Subscriber.Attributes.Integer*| )<br>


|*elseif Subscriber.Attributes.Integer > 20*|


Integer is > 20 ( |*Subscriber.Attributes.Integer*| )<br>


|*else*|


...ELSE Integer must be 20, right? ( |*Subscriber.Attributes.Integer*| )<br>


|*endif*|


 


AND statement


Testing If And <br>


|*if Subscriber.Attributes.company = "Questline" and Subscriber.Attributes.is-customer = "true"*|


Company is Questline, Is Customer is True.<br>


|*else*|


... ELSE Company is not Questline or Customer is not True<br>


|*endif*|


 


OR statement


Testing If Or<br>


|*if Subscriber.Attributes.company = "Questline" or Subscriber.Attributes.company = "quest"*|


Company is Questline or quest.<br>


|*else*|


...ELSE company is neither Questline nor quest.<br>


|*endif*|


 


Begins With/Ends With


Begins With (i.e. James starts with Ja or J or Jam) – this is case insensitive


|*Subscriber.firstname |> Ja *|


 


Ends With (i.e. James starts with es or ames) – this is case insensitive


|*Subscriber.firstname <| mes *|


 


Contains/Does Not Contain


Contains (i.e. James contains am) – this IS case sensitive (has to be due to .NET)


|*Subscriber.firstname ~ am *|


Does Not Contain (i.e. James contains am) – this IS case sensitive (has to be due to .NET)


|*Subscriber.firstname !~ am *|


 


True/False (Variable exists/does not exist, is/is not null)


|*if Subscriber.Attributes.is-customer <> ""*|


Is Customer value is not blank, and in fact is:


|*Subscriber.Attributes.is-customer*|


|*else*|


No Value<br />


|*endif*|


<br/>


 


|*if Subscriber.Attributes.is-customer = ""*|


No Value<br/>


|*else*|


Is Customer value is:


|*Subscriber.Attributes.is-customer*|


|*endif*|


<br/>