Formatting Merge Fields

Numbers

A merge field without formatting is simply the field name surrounded by double carats. For example ^^Pay^^.

Sometimes it is desirable to specify a format that the number should appear in. For example a currency format, a percentage or simply to specify how many decimal places to use. To do this you use a format modifier. The syntax for formatting a field value as a number is

^^fieldname{n:x}^^

where fieldname is the name of the field, the letter n stands for number and x is where you put the format specifier. For example to merge the field Pay in to the message and format it as a currency value you would use

^^Pay{n:c}^^

n stands for number and c stands for currency. In the case of currency the actual format is taken from the regional settings of your Windows operating system.

Below is a table of common specifiers that can be used for a number:

Specifier Type Format Example Merge Field Sample Output for 12.5
c Currency {n:c} ^^Pay{n:c}^^ $12.50
d Decimal (Works with whole
numbers only)
{n:d} ^^Pay{n:d}^^ 13
e Scientific {n:e} ^^Pay{n:e}^^ 1.250000e+001
f Fixed point {n:f} ^^Pay{n:f}^^ 12.50
g General {n:g} ^^Pay{n:g}^^ 12.5
n Number with commas
for thousands
{n:n} ^^Pay{n:n}^^ 12.50

For most of the specifiers in the table above, you can add in a precision value. For example to show a currency value with 3 decimal places you would use

^^Pay{n:c3}^^

You can customize your number formatting using the specifiers below:

Specifier Type Example Sample Output for 1500.42 Note
0 Zero placeholder {n:00.0000} 1500.4200 Pads with zeroes.
# Digit placeholder {n:(#).##} (1500).42
. Decimal point {n:0.0} 1500.4
, Thousand separator {n:0,0} 1,500 Must be between two zeroes.
,. Number scaling {n:0,.} 2 Comma adjacent to Period scales by 1000.
% Percent {n:0%} 150042% Multiplies by 100, adds % sign.
e Exponent placeholder {n:00e+0} 15e+2 Many exponent formats available.

Dates

If the field in the spreadsheet or table is a datetime value you can specify the format the date and/or time is displayed in. A merge field without formatting is simply the field name surrounded by double carats. For example ^^Date^^.

The syntax for formatting a field value as a date or time is

^^fieldname{d:x}^^

where fieldname is the name of the field, the letter d stands for datetime and x is where you put the format specifier. For example to merge the field Date in to the message and format it as a long date value you would use

^^Date{d:D}^^

the first d stands for datetime and the second D stands for long date (see table below). In the case of date the actual format is taken from the regional settings of your Windows operating system.

Below is a table of common specifiers that can be used for a datetime value:

Specifier Type Example (Passed System.DateTime.Now)
d Short date 10/12/2013
D Long date December 10, 2013
t Short time 10:11 PM
T Long time 10:11:29 PM
f Full date & time December 10, 2013 10:11 PM
F Full date & time (long) December 10, 2013 10:11:29 PM
g Default date & time 10/12/2013 10:11 PM
G Default date & time (long) 10/12/2013 10:11:29 PM
M Month day pattern December 10
r RFC1123 date string Tue, 10 Dec 2013 22:11:29 GMT
s Sortable date string 2013-12-10T22:11:29
u Universal sortable, local time 2013-12-10 22:13:50Z
U Universal sortable, GMT December 11, 2013 3:13:50 AM
Y Year month pattern December, 2013

Custom date formatting

You can specify your own format using a combination of the specifiers in the table below.

Specifier Type Example Example Output
dd Day {d:dd} 10
ddd Day name {d:ddd} Tue
dddd Full day name {d:dddd} Tuesday
f, ff, … Second fractions {d:fff} 932
gg, … Era {d:gg} A.D.
hh 2 digit hour {d:hh} 10
HH 2 digit hour, 24hr format {d:HH} 22
mm Minute 00-59 {d:mm} 38
MM Month 01-12 {d:MM} 12
MMM Month abbreviation {d:MMM} Dec
MMMM Full month name {d:MMMM} December
ss Seconds 00-59 {d:ss} 46
tt AM or PM {d:tt} PM
yy Year, 2 digits {d:yy} 02
yyyy Year {d:yyyy} 2013
zz Timezone offset, 2 digits {d:zz} -05
zzz Full timezone offset {d:zzz} -05:00
: Separator {d:hh:mm:ss} 10:43:20
/ Separator {d:dd/MM/yyyy} 10/12/2013
x st/nd/rd/th {d:x} 10/12/2013

For example:

^^Date{d:yyyy-MM-dd}^^

to give an output of

2013-12-10

Another example for appointment reminders can be made to be more user friendly:

Please don't forget your appointment on ^^Date{d:dddd MMMM ddx}^^ at ^^Date{d:HH:mm}^^

would yield the following

Please don't forget your appointment on Tuesday December 10th at 10:38

 
 
© Copyright 2018 Iflow. All Rights Reserved. Terms and Conditions | Privacy Policy