Using Variables Examples

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.

Quick Reference

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}{/}

Basic Variable Usage

Start here if you're new to using variables in document templates. These examples cover fundamental concepts that apply to all document types.

How can I add a table with variables?

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}).

Note: Don't repeat the same opening and closing variable in one table.

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:

How to display default values for blank variables?

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:

You can apply this pattern to any variable where you want to show a default value instead of blank cells, such as:

Document-Specific Examples

These examples are organized by document type to help you find relevant solutions for your specific use case.

Payment Applications

Examples for customizing payment application documents and spreadsheets.

How to remove empty line items from a payment application?

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:

How can I only show costs on scheduled items and not show subtotal amounts in payment applications?

To eliminate subtotals from payment applications or contracts, you can enter your payment line items with {#children.length===0}{xxx}{/}. For example:

How can I configure the budget payment application spreadsheet to split change orders by type?

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?

  1. List "Owner Change Order" for the column in the Excel spreadsheet.

  2. Apply the new type to an OCO.

  3. Match the name to the type in the Excel spreadsheet.

Change Orders

Examples for customizing change order documents including RFQs, CORs, and OCOs.

How can I add the content from the comments section to change order documents?

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.

How can I organize upstream change orders by the main contract SOV?

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.

How can I add work items subtotals and markup subtotals for cost items?

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:

How can I show associated COR and OCO numbers when splitting change orders by type?

To show associated COR and OCO number use the following variables:

The result:

Contracts

Examples for customizing contract documents and Schedule of Values displays.

How can I only show costs on scheduled items and not show subtotal amounts in contract SOV?

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:

How can I refer to the budget code and name in contract document templates?

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:

Advanced Techniques

These examples demonstrate sophisticated variable usage for complex document customization requirements.

Filtering and Conditional Logic

Advanced filtering techniques to show or hide specific data in your documents.

How to use filter functionality on document generation?

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"}

How can I hide the contingency cost in generated documents?

In situations where administrators don't want to make contingency cost visible in the generated document, filters can be used:

The result:

Data Aggregation

Advanced techniques for calculating totals and performing data aggregation in your documents.

Using sumBy for Data Aggregation

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}
Tip:

The sumBy function is particularly useful when you need to show calculated totals that aren't directly available as individual variables.