Skip to main content
Output: The 15th day of January 2025

Converting text to a date

If you are importing data from another system (such as Clio) where the date field arrives as plain text rather than a date type, use as_datetime() with strftime to convert it:
Use %-d instead of %d to suppress the leading zero (e.g., “January 3” instead of “January 03”).

Formatting dates using Calculations (Invisible Logic)

You can also format a date variable through Calculations. Create a new Text variable, select your date variable as the source, choose Format Date as the operation, and enter the format code. The resulting text variable can then be referenced anywhere in your document with {{ FormattedDateVariable }}.

Calculating dates

These functions derive new date values from existing ones — useful for deadlines, notice periods, and age calculations.
Replace years with months, days, or weeks. Use - instead of + to go back in time.
To extract just the day number (e.g., 30):

Formatting numbers

Use a Number question type for decimal values and an Integer question type for whole numbers. Apply the functions below in your document template.
If you use a Number question type, decimal points display by default. If you use an Integer question type, you get a whole number.

Standard number formats

Replace the 2 with the number of decimal places you want.
Replace the 2 with the number of decimal places you want.

Ordinal numbers

Write a number as an ordinal (1st, 2nd, 10th, etc.):
By default, first through ninth are written out as words (first, second, … ninth). To use numerals throughout:

Numbers written as words

Convert a number to its written-out English form (recommended with the Integer question type):
Output: One Hundred Thousand

International number formatting

Output: 1.000.000,00 (European convention — periods as thousand separators, comma as decimal) For Canadian French formatting:
Output: 1 000 000,00$

Rounding in document templates

Round down (floor) to two decimal places:
Round up (ceiling) to two decimal places:
When combining rounding with other number formatting, place the rounding call inside the parentheses:

Formatting special numbers

Use number_custom() to force specific punctuation patterns on any number. Have the client enter the value as a Number question type, then apply the mask in your template using n for each digit position.
Output: (555) 555-5555
Output: 555-555-5555

Formatting words

These functions control capitalization and text transforms. If you want the output to match exactly what the client typed, you do not need any of the functions below.

Case transforms

or
or

Articles and plurals

Add “a” or “an” before a variable automatically:
Output: An apple / A pear Pluralize a noun based on a count variable:
Where variablename is an Integer. Output: 1 apple / 3 apples

Punctuation

Add a trailing period only when the text does not already end with one (useful for company names):

Verb conjugation

To conjugate a verb based on whether one person, multiple people, or a third-party singular is acting:
  1. Create a multiple-choice question with variable name conjugation and choices: 1sg, 3sg, pl.
  2. Use this syntax in your template (replacing allege with your verb):
Output: allege (1sg), alleges (3sg), or allege (pl). Alternatively, use basic conditional logic:

Formatting text area questions

Text area variables require special handling to preserve line breaks in the output.
Useful when a client enters a multi-line address and you need to output it inline, such as: Jane Doe, 123 Main Street, Minneapolis, MN 55436.

Formatting Multi-Select questions

Multi-Select questions have several output formats you can use in Word document templates. As a bulleted list:
Count the number of selections:
Conditional on number of selections:
Preserve the order you defined (non-alphabetical):