Template fields and functions

Prev Next

This page lists what you can put in an Exact Forms Plus document template: how each type of field appears, how to format dates, how to insert images, and the functions for numbers, currency, barcodes, and charts. To build a template and add it to Quickbase, see Exact Forms Plus document templates.

Two rules apply to everything on this page:

  • Tokens go between tildes (~), for example ~Customer Name~ or ~5~.

  • Every field you use, including inside a function, must be in the template's clist. If it isn't, the token is left in the document as typed. See Insert field values.

How field types appear

Field type

In the document

Text, numeric, currency

The value as Quickbase returns it, for example $7,485.52.

Text with Allow some HTML tags to be interpreted turned on, rich text

The HTML is converted to Word formatting (bold, lists, links, and so on).

Date

A short date, for example 3/22/2010. To use another format, see Dates.

Date/time

Date and time, for example 03-22-2010 02:30:00 PM, in the app's time zone.

Numeric percent

The percentage, for example 8.625% for a value of 8.625%.

Checkbox

A Word check box, checked or not, sized to the surrounding text.

User

The raw value Quickbase returns, not the person's name. To show the name, create a formula text field with UserToName([My User Field]) and use that field in the template instead.

File attachment with an image

The image, 300 wide. To set the size, use an image token (see Images).

Dates

To format a date field, use ~d#f[field ID]#format~. The format uses the standard date codes: d/dd day, ddd/dddd weekday name, M/MM month number, MMM/MMMM month name, yy/yyyy year.

For example, with field 26 a date field holding 3/22/2010:

In the template

In the document

~26~

3/22/2010

~d#f[26]#MM/dd/yyyy~

03/22/2010

~d#f[26]#MMM-dd-yyyy~

Mar-22-2010

~d#f[26]#MMMM-dd-yyyy~

March-22-2010

~d#f[26]#dddd, dd MMMM yyyy~

Monday, 22 March 2010

~d#f[26]#dddd, MMMM dd, yyyy~

Monday, March 22, 2010

~d#f[26]#MMMM dd~

March 22

~d#f[26]#yyyy MMMM~

2010 March

  • If the field is empty, the token is replaced with nothing.

  • Use a date format only. If the format contains a time (a colon), only the date part is used and the time is always added as hh:mm:ss AM/PM.

The current date

Replace f[26] with today, for example ~d#today#MM/dd/yyyy~. The date comes from the Exact Forms Plus server, which runs on US Eastern time. For another US time zone, use today(CST), today(MST), or today(PST), which subtract 1, 2, or 3 hours.

You can also let Word insert the date. Word fills it in when the document is opened, not when it's created:

  1. In the template, put the cursor where the date should appear.

  2. On the Insert tab, in the Text group, select Date & Time (tooltip Insert Date and Time).

  3. Choose a format, select the Update automatically check box, and select OK.

Images

Use an image token to insert an image and set its size: ~i:field ID:size~. Image tokens take a field ID, not a field name.

Token

Result

~i:100:400~

400 points wide (72 points = 1 inch). The height keeps the image's proportions. Up to 3 digits.

~i:100:200x150~

Exactly 200 wide and 150 high. The image can look stretched if the proportions differ.

~i:100:25%~

The original size made 25% smaller.

~i:100:25%F~

25% of the original size.

~100~

On an image field, the image 300 wide.

The field can be:

  • a file attachment field that holds an image;

  • a text or formula text field whose value is a link to an image, in Quickbase or on another website, for example a formula that points to a file attachment in another table. An HTML <img> tag works too, and if the image is inside a link, the link is kept.

Supported image types: .jpg, .jpeg, .png, .gif, .bmp, .tif, .tiff, .wmf. Photos taken on phones are turned the right way up automatically. Formula URL fields that link to an image on another website aren't converted; use a formula text field instead.

Tip: try a few sizes in test documents until the image fits.

Functions

Functions start with ~=. Inside a function, refer to a field as f[field ID]. Functions work in the main part of the template, not inside embedded reports.

Numbers in words

~=FormatN(f[field ID],option)~ writes a number in words. The options are:

Option

Writes the number as

$

Dollars and cents, each word capitalized

$l

Dollars and cents, all lowercase

€

Euros and cents, each word capitalized

€l

Euros and cents, all lowercase

n

A plain number, each word capitalized

nl

A plain number, all lowercase

To type € in Windows, hold Alt and type 0128 on the number pad. For example, with field 13 a currency field holding $7,485.52 and field 14 a numeric field holding 6,542.99:

In the template

In the document

~13~

$7,485.52

~=FormatN(f[13],$)~

Seven Thousand Four Hundred Eighty Five Dollars and Fifty Two Cents

~=FormatN(f[13],$l)~

seven thousand four hundred eighty five dollars and fifty two cents

~=FormatN(f[13],€)~

Seven Thousand Four Hundred Eighty Five Euros and Fifty Two Cents

~=FormatN(f[13],€l)~

seven thousand four hundred eighty five euros and fifty two cents

~14~

6,542.99

~=FormatN(f[14],n)~

Six Thousand Five Hundred Forty Two point Ninety Nine

~=FormatN(f[14],nl)~

six thousand five hundred forty two point ninety nine

If the field isn't a number, the document shows Format Function Error: … is not numeric, it cannot be reformatted.

Ordinal numbers

~=FormatO(f[field ID],option)~ writes a number as a position in a list. With field 15 holding 1:

In the template

In the document

~15~

1

~=FormatO(f[15],s)~

1ST

~=FormatO(f[15],sl)~

1st

~=FormatO(f[15],p)~

First

~=FormatO(f[15],pl)~

first

The options are case-sensitive: use lowercase s, sl, p, pl.

Currency symbols

If a currency field uses a symbol other than $, the symbol may not come through correctly. Use ~=C|symbol|f[field ID]~ to put the symbol in front of the value, for example ~=C|€|f[99]~.

Barcodes and QR codes

~=barcode(f[field ID],type,widthxheight)~ turns a field's value into a barcode, for example ~=barcode(f[123],qrcode,50x50)~. For the supported types, text and size options, barcodes in embedded reports, and error messages, see Add barcodes and QR codes in Exact Forms Plus.

Charts

~=Chart:template ID:chart ID:size~ inserts a chart from a Quickbase Document Creation template. See Charts and graphs for EF+.

See also: Exact Forms Plus document templates, Exact Forms Plus formula URL parameters.