Some variables are provided with formatting options that allow you to specify the output format.
The date format option allows you to specify in what form the dates are output.
{variable | date:'format'}
Where variable
is one of the variables above and format
specifies the format of the date. For example:
{rfq.createdAt | date:'MM DD, YYYY'}
Refer to Moment.js for additional date formats.
The boolean format option allows you to use a boolean operator to output customized text.
{variable | bool:'true value': 'false value': 'N/A value'}
Where variable
is one of the variables, for example:
{rfq.properties['is approved'] | bool:'Y': 'N'}
{rfq.properties['is approved'] | bool:'GOOD': 'BAD': 'NA'}
Create a checkbox for custom attributes example:
{rco.properties["checkbox3-1"] | bool: “☒”:”☐”}
The number format option allows you to specify the form of numerical outputs.
{variable | number:'decimal points': 'group separator': 'fraction separator'}
Where variable
is one of the variables, decimal points
specifies the number of decimal points after the fraction separator, group separator
specifies the symbol to use for the group separator, fraction separator
specifies the symbol to use for the fraction separator. For example:
{rco.approved | number:'2': ',': '.'}
would return a number such as 10,050.89.
You may add written currency to the number format variables by using the format writtenCurrency:'USD'
. For example:
{contract.awarded | writtenCurrency:'USD'}
where you can replace USD
with the actual currency of the awarded contract.
Math functions and rounding can be applied to variables on documents. Add, subtract, multiply, and divide are all supported.
Examples:
{rfq.approved | add: 1}
{rfq.approved | minus: 2}
{rfq.approved | multiply: 1.13}
{rfq.approved | divide: 1.1}
Math and rounding example:
{rfq.approved | divide: 1.5 | rounding: '0.1': 'half-up'}
You can also create more advanced math variables, which may be helpful when working with document templates for payment applications. For example:
Variables | Description |
{previousQuantity | add: quantity | rounding: '0.01': 'half-up'} | Returns Total to Date Quantity of the payment application |
{previousAmount | add: amount | rounding: '0.01': 'half-up'} | Returns Total to Date Amount of the payment application |
{payment.lineView.totalPreviousAmount | add: payment.lineView.totalAmount | rounding: '0.01': 'half-up'} | Returns Grand Total Amount of the payment application |
The text format options allow you to control the case of the word output by the variable.
{variable | case}
Where variable
is one of the variables and case
represents one of the following:
uppercase
lowercase
capitalize
titlecase
For example:
{owner.name | uppercase}
Returns the owner company name in all caps.
To pull rich text formatting (e.g., bold, italic) into a Word document template, you need to add an "@" symbol to the custom variable.
For example:
If you have a note variable {rco.note}
, adding an "@" symbol will look like this: {@rco.note}
. This change will ensure that the rich text formatting from the Change Order notes is included.
You can remove file extentions from generated documents. For example, if you are using the variable {{{-w contract.exhibits}{targetName}{/contract.exhibits}}}
, it can include the filename extension .docx or .pdf in the generated document.
If all your files are in .docx format, you can remove the extension by using the trimEnd
function:
{targetName | trimEnd:'.docx'}
If you have both .docx and .pdf files and want to remove both extensions, you can chain the trimEnd
function like this:
{targetName | trimEnd:'.docx' | trimEnd:'.pdf'}
The composite format option allows you to combine two other formats.
{variable | format1 | format2}
Where variable
is one of the variables and format1
and format2
represent two different format options from above.
For example:
{rco.approved | written | uppercase}
The split
function allows you to separate a string into different parts based on a specific character or set of characters, also known as the delimiter.
Here's an example:
{ number | split:'-' | get:'1' }
This command will split the string stored in the number
variable at each -
and then get the second part of the split string (since counting starts from 0).
Let's say your number
variable contains the string "1.1-001-ABC 01-CD EF 00FF-1.9G". Here's what each get
command will return:
get:'0'
: 1.1get:'1'
: 001get:'2'
: ABC 01get:'3'
: CD EF 00FFget:'4'
: 1.9GAlternatively, you can use the slice
function or the last
command to extract parts of the string:
{sco.number | slice':-3'}
.{sco.number | split:'-' | last}
to get the last part of the split string.When you have a list or collection of data, you can sort it in either ascending (asc
) or descending (desc
) order by number.
Use the following format:
{#variable | sortBy:'number':'order'}{/variable | sortBy:'number':'order'}
For example:
{#oco.pco | sortBy:'number':'asc'}{/oco.pco | sortBy:'number':'asc'}