Advanced Template Editor Functions

Template Coding Variable Formats

There are a number of ways you can change the formatting of a particular code to suit your preference, e.g. write the date in letters instead of numbers.

Variable Format Type

When using the I Variable type, this will format the data in the desired way.

The valid Format Types are:

C: Capital

This is used when you want to format variable to capitalise the first letter of only the first word. All other letters become lower case. E.g. <i:m-mat:C> 

C2: Capital for multiple words

This is used when you want to format variable to capitalise the first letter of every word. All other letters become lower case. E.g. <i:m-mat:C2> 

D: Date

This is used when formatting the variable into a date format.

L: Lower Case

This is used when formatting a text value into lower case. varformatextra is ignored.

N: Numeric

This is used when formatting the variable into a numeric format.

S: String

This is used when formatting the variable into a string format.

T: Time

This is used when formatting the variable into a time format.

U: Uppercase

This is used when formatting a text value into upper case. varformatextra is ignored. All letters are uppercase in this instance (not to be confused with C & C2 above).

W: Currency in Words

This is used when you want to show the total payable in words with currency indicators E.g. One Thousand and Twenty Two dollars and fifty two cents. <i:i-pay:W>  

W2: Numbers in Words

This is used when you want to show the total payable in words without currency indicators. E.g. One Thousand and Twenty Two point five two. <i:i-pay:W2>  

Variable Format Extra

The Format Extra gives extra information as to how the variable should be formatted.

Dates D:[d]n[s][B]

d: Day of week specifier. If a d is included at the beginning of the format it will prepend the day of week.

n: Determines the date picture format. Date picture formats range from 1 through 18. A leading zero (0) indicates a zero-filled day or month.

s: A separation character between the month, day, and year components. If omitted, the slash ( / ) appears.

. (period) Produces periods
' (grave accent) Produces commas - (hyphen) Produces hyphens
_ (underscore) Produces spaces

range: An integer constant in the range of zero (0) to ninety-nine (99) that specifies the "Intellidate" century for the direction parameter. Valid only on date pictures with two-digit years. If omitted, the default value is 80.

B: Specifies that the format displays as blank when the value is zero.

Examples:

20

Picture

Format

Result

D:1

mm/dd/yy

10/31/59

D:01

mm/dd/yy

01/01/59

D:2

Mm/dd/yyyy

10/31/1959

D:3

mmm dd, yyyy

OCT 31, 1959

D:4

mmmmmmmmm dd, yyyy

October 31, 1959

D:D4

dddd, mmmmmmmmm dd, yyyy

Tuesday, October 31, 1959

D:5

dd/mm/yy

31/10/59

D:6

dd/mm/yyyy

31/10/1959

D:7

dd mmm yy

31 OCT 59

D:8

dd mmm yyyy

31 OCT 1959

D:9

yy/mm/dd

59/10/31

D:10

yyyy/mm/dd

1959/10/31

D:11

yymmdd

591031

D:12

yyyymmdd

19591031

D:13

mm/yy

10/59

D:14

mm/yyyy

10/1959

D:15

yy/mm

59/10

D:16

yyyy/mm

1959/10

D:17

Windows Control Panel settings for Short Date

D:18

Windows Control Panel settings for Long Date

 

Additional Date Formats

Within the D format instead of a number there are additional options in addition to the standard 18 formats above:

The examples below are based on the date being 24/2/2022

DAY – The day of the month - <i:today:d:day> -> 24

DAYORD – The ordinal day of the month which includes a suffix <i:today:d:dayord> -> 24th

MON – The numeric month - <i:today:d:mon> -> 2

MONTXT – the short name of the month - <i:today:d:montxt> -> Feb

MONTXT2 – The long name of the month - <i:today:d:montxt2> -> February

YY – The short year - <i:today:d:yy> -> 22

YYYY Or YEAR – 4 digit year - <i:today:d:yyyy> -> 2022

LAST – Last day of the month - <i:today:d:last> -> 28

LASTORD – Last day of the month with ordinal - <i:today:d:lastord> -> 28th


As a result, someone could use more than one of these to achieve a very specific format not supported by the standard 18 formats. Eg <i:today:d:lastord> of <i:today:d:montxt2> would give “28th of February”

 

Alternate Separators

D:1. mm.dd.yy            Period separator
D:2- mm-dd-yyyy        Dash separator
D:5_ dd mm yy           Underscore produces space separator
D:6' dd,mm,yyyy         Grave accent produces comma separator

Time
T:
n[s][B]

n: Determines the time picture format. Time picture formats range from 1 through 8. A leading zero (0) indicates zero-filled hours.

s: A separation character. By default, colon ( : ) characters appear between the hour, minute, and second components of certain time picture formats. The following s indicators provide an alternate separation character for these formats.

. (period) Produces periods
' (grave accent) Produces commas - (hyphen) Produces hyphens
_ (underscore) Produces spaces

B: Specifies that the format displays as blank when the value is zero.

Examples:

Picture

Format

Result

T:1

hh:mm

17:30

T:2

hhmm

1730

T:3

hh:mmXM

5:30PM

T:03

hh:mmXM

05:30PM

T:4

hh:mm:ss

17:30:00

T:5

hh:mm:ss

173000

T:6

hh:mm:ssXM

5:30:00PM

T:7

Windows Control Panel settings for Short Date

T:8

Windows Control Panel settings for Long Date


T:1. hh.mm                 Period separator
T:1- hh-mm                 Dash separator
T:3_ hh mmXM           Underscore produces space separator
T:4' hh,mm,ss             Grave accent produces comma separator

Numeric

N:[currency][sign][fill]size[grouping][places][sign][currency][B]

currency: Either a dollar sign ($) or any string constant enclosed in tildes (~). When it precedes the sign indicator and there is no fill indicator, the currency symbol "floats" to the left of the high order digit. If there is a fill indicator, the currency symbol remains fixed in the left-most position. If the currency indicator follows the size and grouping, it appears at the end of the number displayed.

sign: Specifies the display format for negative numbers. If a plus (+) precedes the fill and size indicators, positive numbers will display with a leading plus (+) sign and negative numbers will display with a leading minus (-) sign. If a hyphen precedes the fill and size indicators, negative numbers will display with a leading minus sign. If a hyphen follows the size, places, and currency indicators, negative numbers will display with a trailing minus sign. If parentheses are placed in both positions, negative numbers will be displayed enclosed in parentheses. To prevent ambiguity, a trailing minus sign should always have grouping specified.

fill: Specifies leading zeros, spaces, or asterisks (*) in any leading zero positions, and suppressesdefault grouping. If the fill is omitted, leading zeros are suppressed.

0 (zero) Produces leading zeroes
_ (underscore) Produces leading spaces * (asterisk) Produces leading asterisks

size: The size is required to specify the total number of significant digits to display, including the number of digits in the places indicator and any formatting characters.

grouping: A grouping symbol, other than a comma (the default), can appear right of the size indicator to specify a three digit group separator. To prevent ambiguity, a hyphen grouping indicator should also specify the sign.

. (period) Produces periods
- (hyphen) Produces hyphens
_ (underscore) Produces spaces

places: Specifies the decimal separator symbol and the number of decimal digits. The number of decimal digits must be less than the size. The decimal separator may be a period (.), grave accent (' ) (produces periods grouping unless overridden), or the letter "v" (used only for STRING field storage declarations--not for display).

. (period) Produces a period
' (grave accent) Produces a comma v Produces no decimal separator

B: Specifies blank display whenever its value is zero.

The numeric and currency pictures format numeric values for screen display or in reports. If the value is greater than the maximum value the picture can display, a string of pound signs (#) is displayed.

Examples:

Numeric

Result

Format

N:9

4,550,000

Nine digits, group with commas (default)

N:_9B

4550000

Nine digits, no grouping, leading blanks if zero

N:09

004550000

Nine digits, leading zero

N:*9

***45,000

Nine digits, asterisk fill, group with commas

N:9_

4 550 000

Nine digits, group with spaces

N:9.

4.550.000

Nine digits, group with periods

 

Decimal

Result

Format

N:9.2

4,550.75

Two decimal place, period decimal separator

N:_9.2B

4550.75

Two decimal places, period decimal separator, no grouping, blank if zero

N:9'2

4550,75

Two decimal places, comma decimal separator

N:9.'2

4.550,75

Comma decimal separator, group with periods

N:9_'2

4 550,75

Comma decimal separator, group with spaces

 

Signed

Result

Format

N:-9.2B

-2,347.25

Leading minus sign, blank if zero

N:9.2-

2,347.25-

Trailing minus sign

N:(10.2)

(2,347.25)

Enclosed in parens when negative

 

Dollar

Result

Format

N:$9.2B

$2,347.25

Leading dollar sign, blank if zero

N:$10.2-

$2,347.25-

Leading when dollar sign, trailing minus when negative

N:$(11.2)

$(2,347.25)

Leading dollar sign, in parens when negative

 

String

S:
length

length
: Determines the number of characters in the picture format. A string picture describes an unformatted string of a specific length.

Example:

Format: S:10
Original Value:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
Formatted Value:
ABCDEFGHIJ