Formatting
Number and Currency Formatting
To apply number and currency formatting, add a numeric format switch \#.
Numeric format switches are used in combination with the following:
Switch |
Description |
0 (zero) |
Specifies the minimum numeric places to display including leading zeroes. EXAMPLE {MERGEFIELD current_interest_rate \# 00.00} displays 05.00 |
# |
Specifies the minimum numeric places to display. If a place has no digit, it is replaced with a space. EXAMPLE {MERGEFIELD payment_amount \# $###} displays $ 10 |
x |
Does not display digits to its left and if used to the right of a decimal point, the result is rounded to that place. EXAMPLE {MERGEFIELD cifno \# x##} displays 111 if cifno is 123111 |
. (decimal point) |
Places a decimal point in its position. |
, (comma) |
Places a digit grouping symbol (thousand separator) as specified in the regional settings in the Control Panel. EXAMPLE {MERGEFIELD current_payoff_balance \# $,0.00} displays $1,234.56 |
- (minus) |
Places a minus sign on a negative result or adds a space if the result is positive or zero. EXAMPLE {MERGEFIELD current_payoff_balance \# "$#,##0.00;- $#,##0.00"} displays $1,234.56 for a positive number and - $1,234.56 for a negative number |
+ (plus) |
Places a plus sign to a positive result, a minus sign to a negative result, or a space if the result is zero. EXAMPLE {MERGEFIELD current_payoff_balance \# "+ $#,##0.00"} displays + $1,234.56 for a positive number and - $1,234.56 for a negative number |
() (parenthesis) |
Places negative number within parenthesis and a hyphen in place of zero. EXAMPLE {MERGEFIELD current_payoff_balance \# "$,0.00;($,0.00);'-'"} displays $1,234.56 for a positive, (1,234,56) for a negative number, and - for zero. |
Date Formatting
To apply date formatting, use the date-time format switch \@.
Switch |
Description |
yyyy |
Year. Use yy to display the last two digits of any year. |
M |
Month. Use MMMM to fully spell out the month (e.g. September, October). Use MMM to display the three letter abbreviation for the month (e.g. Sep, Oct). Use MM to display the month in two digits with a leading zero for single digit months (e.g. 09, 10). Use M to display the month in digits (e.g. 9, 10). |
d |
Day. Use dddd to spell out the day of the week (e.g. Sunday, Monday). Use ddd to display the three letter abbreviation of the day (e.g. Sun, Mon). Use dd to display the day in two digits with a leading zero for single digit days (e.g. 09, 10). Use d to display the day in digits (e.g. 9, 10). |
EXAMPLE:
{MERGEFIELD payoff_date \@ "dddd, MMMM d yyyy"} results in Friday, August 5 2016
{MERGEFIELD payoff_date \@ "ddd, d MMM yyyy"} results in Fri, 5 Aug 2016
{MERGEFIELD payoff_date \@ "yyyy.MM.dd"} results in 2016.08.05
{MERGEFIELD payoff_date \@ "d-M-yy"} results in 5-8-16
Time Formatting
To format how time is displayed, use the date-time format switch \@.
Switch |
Description |
h or H |
Hours. Lower case h denotes 12-hour format and upper case H denotes 24-hour format. Use hh or HH to display a leading zero on single digit hours. |
m |
Minutes. Use mm to display a leading zero on single digit minutes. |
s |
Seconds. Use ss to display a leading zero on single digit seconds. |
AM/PM |
Displays AM or PM. |
EXAMPLE
{MERGEFIELD time \@ HH:mm} displays 13:01
{MERGEFIELD time \@ h:mm:ss AM/PM} displays 1:01:01 PM
U.S. Social Security Number Formatting
Suppress the first five digits in a social security number stored in the TIN1 field formatted as ‘123-45-6789’.
EXAMPLE:
{QUOTE
{SET ID {MERGEFIELD cif_tin}}
{SET Last4 {=({ID}*(-1)-ID)/2}}"XXX-XX-"{Last4 \# 0000}}
123-45-6789 results in XXX-XX-6789
U.S. Zip Code Formatting
Format zip codes as a 5-digit or 5+4-digit zip code.
EXAMPLE:
{QUOTE
{SET ZipCode {MERGEFIELD zip}}
{IF{ZipCode}> 99999 {SET ZipCode {ZipCode \# "00000'-'0000"}}}
"{=-{=-{ZipCode}-ZipCode}/2 \# 00000;;}{=-({ZipCode}*(-1)-ZipCode)/2 \# ;-0000;}"}
12345 results in 12345
123450000 results in 12345
12345-0000 results in 12345
123451111 results in 12345-1111
Selective Line Break Insertion
Use \b and \f switches to insert line breaks when needed.
EXAMPLE
{MERGEFIELD street_address1}
{MERGEFIELD street_address2 \f "↲"}
{MERGEFIELD city}, {MERGEFIELD state} {MERGEFIELD zip}
Replace ↲ with an actual line break (Shift-Enter)
If all fields are not blank, the result will be
123 Main
MS 123
Any Town, CA 00000
If street_address2 is blank, the result will be
123 Main
Any Town, CA 00000
Without the \f switch, there would be an empty line between street_address1 and the city/state/zip line.