Follow

Variable Data

Table of Contents

Overview

Data tags are used to set variables and output results to the content.  

Tags

The Value of a Variable may be Integer, Float, Date, or String, and may be defined from a literal (strings must be within double quotes), another variable (set in the template ), date part ($customDate.month), builtin (builtin.today - without preceding $), or Subscriber or Custom Data ($email, $customString).

The following tables include all Data related Tags.

Tag %%set NAME = DATE%%
Parameters

NAME: Alphanumeric string with no spaces or special characters DATE: Literal, Variable, Builtin, Custom Data, Subscriber Data, or Logical Evaluation string

Output Set the value of the variable to the defined Date
Example %%set date1 = 12/31/1975%%%%$date1%%
Result 12/31/1975
Example %%set date2 = 5/20/2011%%%%$date2%%
Result 5/20/2011
Example %%set date3 = $date2%%%%date3%%
Result 5/20/2011
Example %%set date4 = $customDate%%%%$date4%%
Result 1/15/1999
Example %%set date5 = builtin.today%%%%$date5%%
Result 10/4/2012
Example %%set date6 = {{eval dateadd $date2 [11]}}%%%%$date6%%
Result 5/31/2011
   
Tag %%set NAME = INTEGER%%
Parameters NAME: Alphanumeric string with no spaces or special characters INTEGER: Literal, Variable, Date Part, Builtin, Custom Data, Subscriber Data, or Logical Evaluation string
Output Set the value of the variable to the defined Integer
Example %%set integer1 = 12%%%%$integer1%%
Result 12
Example %%set integer2 = 24%%%%$integer2%%
Result 24
Example %%set integer3 = $integer2%%%%integer3%%
Result 24
Example %%set integer4 = $customNumber%%%%$integer4%%
Result 36
Example %%set integer5 = $zip%%%%$integer5%%
Result 98012
Example %%set integer6 = $date1.day%%%%$integer6%%
Result 31
Example %%set integer7 = builtin.month%%%%$integer7%%
Result 6
Example %%set integer8 = {{eval rand $integer1 $integer3}}%%%%$integer8%%
Result random number between 12 and 24
Example %%set integer9 = {{if integer3 < 5 then print "0" else print "1"}}%%%%$integer9%%
Result 1
   
Tag %%set NAME = FLOAT%%
Parameters NAME: Alphanumeric string with no spaces or special characters FLOAT: Literal, Variable, Date Part, Builtin, Custom Data, Subscriber Data, or Logical Evaluation string
Output Set the value of the variable to the defined Float
Example %%set float1 = 12.25%%%%$float1%% %%set float2 = 1.25%%%%$float2%%
Result 12.25 1.25
Example %%set float3 = $float2%%%%$float3%%
Result 1.25
Example %%set float4 = $customFloat%%%%$float4%%
Result 17.76
Example %%set float5 = {{eval add $float1 $float2 [p=2]}}%%%%$float5%%
Result 13.5
Example %%set float6 = {{if float2 < 5 then print "2.33" else print "4.95"}}%%%%$float6%%
Result 2.33
   
Tag %%set NAME = "STRING"%%
Parameter

NAME: Alphanumeric string with no spaces or special characters STRING: Literal, Variable, Date Part, Builtin, Custom Data, Subscriber Data, or Logical Evaluation string

Output Set the value of the variable to the defined String
Example %%set string1 = "Hello"%%%%$string1%% %%set string2 = "World"%%%%$string2%%
Result Hello World
Example %%set string3 = $string1%%%%$string1%%
Result Hello
Example %%set string4 = $customString%%%%$string4%%
Result World
Example %%set string5 = $email%%%%$string5%%
Result myemail@ mydomain.com
Example %%set string6 = $date1.monthname%%%%$string6%%
Result December
Example %%set string7 = builtin.monthname%%%%$string7%%
Result October
Example %%set string8 = {{base64encode $string1}}%%%%$string8%%
Result SGVsbG8=
Example %%set string9 = {{if integer1 > integer2 then print "TRUE" else print "FALSE"}}%%%%$string9%%
Result FALSE
   
Tag %%PRINT VARIABLE%%
Parameters VARIABLE: Name of variable value to display
Output Output the value of the variable
Example %%set var = "Print Me"%%%%PRINT var%%
Result Print Me
   
Tag %%DATA VARIABLE%%
Parameters VARIABLE: Name of variable value to display
Output Output the value of the variable
Example %%set var = "Print Me"%%%%DATA var%%
Result Print Me
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk