You can combine some of the variables to achieve more complex results. See the examples of using variables in different scenarios organized by complexity and use case.
Common variable patterns and their use cases:
Pattern | Use Case | Example |
---|---|---|
{#variable}...{/variable} |
Loop through items | {#markups}{name}{/markups} |
{#!variable}...{/} |
Show when variable is empty | {#!amount}$0.00{/} |
{#variable}...{/}{#!variable}...{/} |
Show value or default | {#previousAmount}{previousAmount}{/}{#!previousAmount}0{/} |
{variable | filter:"field":"value"} |
Filter data | {items | filter:"type":"SOV"} |
{variable | sumBy:"field"} |
Calculate totals | {items | sumBy:"approved"} |
{#condition}...{/} |
Conditional display | {#amount!="0.00"}{amount}{/} |
Start here if you're new to using variables in document templates. These examples cover fundamental concepts that apply to all document types.
You can use variables and present your data in the form of a table with columns and headers. Here's an example of syntax:
Use the opening section variable, starting with #
(for example, {#markups}
) and closing one with /
(for example, {/markups}
).
Wrong usage:
Correct usage:
Between opening and closing variables, you can list all the necessary data, like {name} or {description}.
The result in generated document:
Scenario: You're using variables like {previousAmount}
and {materialsStored}
in your document template, but when generating documents, some columns show blank instead of displaying "$0" values.
To display a default value when a variable is empty or blank, use conditional expressions with the following pattern:
{#variableName} {variableName} {/}{#!variableName}default_value{/}
For example, to show "0" when {previousAmount}
is blank:
{#previousAmount} {previousAmount} {/}{#!previousAmount}0{/}
This conditional expression works as follows:
{#previousAmount}
- If previousAmount has a value, display it{previousAmount}
- The actual variable value{/}
- Close the first condition{#!previousAmount}
- If previousAmount does NOT have a value (is blank/empty)0
- Display "0" as the default value{/}
- Close the second conditionYou can apply this pattern to any variable where you want to show a default value instead of blank cells, such as:
{#materialsStored} {materialsStored} {/}{#!materialsStored}$0.00{/}
{#currentAmount} {currentAmount} {/}{#!currentAmount}0{/}
These examples are organized by document type to help you find relevant solutions for your specific use case.
Examples for customizing payment application documents and spreadsheets.
To remove empty line items from a payment application use the conditional expression {#amount!="0.00"}
at the beginning of a table and {/}
at the end of the line. For example:
To eliminate subtotals from payment applications or contracts, you can enter your payment line items with {#children.length===0}{xxx}{/}
. For example:
Scenario: You have created a change order type called "Allowance Transfers".
And want to see the approved owner changes for these allowances in the Excel spreadsheet. How to do that?
List "Owner Change Order" for the column in the Excel spreadsheet.
Apply the new type to an OCO.
Match the name to the type in the Excel spreadsheet.
Examples for customizing change order documents including RFQs, CORs, and OCOs.
Scenario: You want to create a document containing the comments added throughout the lifetime of a change order.
The example shows {#rfq.comments}
as the opening tag for the variables and {/rfq.comments}
as the closing tag. The other related variables must be between these two variables.
For example, an RFQ with the following comments section:
Adding a table into a Word document with the following:
Results in:
Only one line of a table needs to be filled out in the document template. The software builds the table with the specified information based on the data in Cost Management.
To organize CORs or OCOs by the main contract's Schedule of Values in your document template. For CORs, use this pattern:
And for OCOs, replace rco
with oco
.
Scenario: You're creating a change order document (for example, OCO) and want to have two separate tables within. One for regular cost items with a subtotal and the second for markup cost items. You want to add total change order pricing as well. How to do that? Here's an example of used variables in a document:
To show associated COR and OCO number use the following variables:
{this.costItem.corNumber}
{this.costItem.ocoNumber}
The result:
Examples for customizing contract documents and Schedule of Values displays.
Scenario: You want to create a contract with only the subtotal of SOV subitems displayed. You don't want a parent item to be visible to a subcontractor. To do that, use these variables from the document template:
Also, you don't want to show the Unit Cost and Amount values as $0. You can replace $0 with the word "Included". How to do that? Enrich already used variables:
The outcome in the generated contract will look like this:
To refer to a budget code and name in the document template, use this formula:
For example, when the Schedule of Values for the contract looks like this:
The presented formula generates this:
These examples demonstrate sophisticated variable usage for complex document customization requirements.
Advanced filtering techniques to show or hide specific data in your documents.
You can use filter functionality on document generation. For example, to only show the Risk Contingency item, use {#payment.columnView.rootItems | filter:"name":"Risk Contingency"}
variable:
Result:
Members can also separate original Schedule of Values with all approved SCOs into two separate worksheets.
To generate a worksheet that includes only the Original SOVs, use the following variable:
{#payment.lineView.rootItems | filter:"associationType":"SOV"} {/payment.lineView.rootItems | filter:"associationType":"SOV"}
To generate a worksheet that includes only the approved SCOs, use the following variable:
{#payment.lineView.rootItems | filter:"number":"Change Orders"} {/payment.lineView.rootItems | filter:"number":"Change Orders"}
In situations where administrators don't want to make contingency cost visible in the generated document, filters can be used:
The result:
Advanced techniques for calculating totals and performing data aggregation in your documents.
The sumBy
function helps to aggregate values within your data set.
Example 1: Calculate the subtotal of each PCO's regular cost items' approved values.
{#oco.pco}{regular | sumBy:'approved'}{/oco.pco}
Example 2: Calculate the total of each PCO's all cost items' approved values.
{#oco.pco}{this | getAll: "costItems" | sumBy: "approved"}{/oco.pco}
The sumBy
function is particularly useful when you need to show calculated totals that aren't directly available as individual variables.