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.

In this article:

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}{/}
{variable | groupItemsByXCO: 'type'} Group by change order type {items | groupItemsByXCO: 'COR'}

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:

Example of table variable syntax showing opening and closing markup variables

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:

Wrong usage example showing repeated opening and closing variables in one table

Correct usage:

Correct usage example showing proper opening and closing variable structure

Between opening and closing variables, you can list all the necessary data, like {name} or {description}.

Table variable syntax example with name and description variables

The result in generated document:

Generated document result showing formatted table with variable data

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:

Example of conditional expression to remove empty line items from payment applications

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:

Example showing how to eliminate subtotals using children.length condition

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

Change order type setup showing Allowance Transfers configuration

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.

    Excel spreadsheet showing Owner Change Order column setup

  2. Apply the new type to an OCO.

    OCO with Allowance Transfers type applied

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

    Excel spreadsheet showing matched type name configuration

How can I add a new tab without subtotals to the cost payment application spreadsheet?

Scenario: You want to create a new tab in the default cost payment application spreadsheet template that shows only scheduled items without displaying subtotal amounts.

To add a new tab without subtotal to your cost payment application spreadsheet template, use the following variable pattern:

{#children.length===0}{xxx}{/}

This conditional expression ensures that only line items without subtotals are displayed in the generated spreadsheet tab. The {xxx} represents the specific data fields you want to include for each line item.

Use case: This is particularly useful when you want to provide subcontractors with a clean view of individual work items without the complexity of subtotal calculations.

How can I add a grouped COR tab to the budget payment application spreadsheet?

Scenario: You want to create a new tab in the default budget payment application spreadsheet template that groups items by COR (Change Order Request) without showing individual cost item details.

To add a new tab, called "Optional details grouped by COR" for example, to your budget payment application spreadsheet template, use the following variable pattern:

{#payment.lineView.rootItems|groupItemsByXCO: 'COR'}{number}{/payment.lineView.rootItems|groupItemsByXCO: 'COR'}

This variable groups payment line items by their associated COR and displays only the COR numbers without the underlying cost item details.

Key features:

Note: The generated document does not include cost item details, providing a summary view focused on COR organization.

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:

RFQ comments section showing multiple comment entries

Adding a table into a Word document with the following:

Word document template showing RFQ comments variable syntax

Results in:

Generated document output showing formatted comments table

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:

Variable pattern for organizing CORs by main contract Schedule of Values

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:

OCO document template showing separate tables for work items and markup subtotals

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:

Document template showing COR and OCO number variables

The result:

Generated document showing COR and OCO numbers in change order table

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:

Document template showing child variable syntax for SOV subitems

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:

Enhanced child variable template replacing $0 values with 'Included'

The outcome in the generated contract will look like this:

Generated contract showing SOV subitems with 'Included' replacing $0 values

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:

Document template formula for referencing budget code and name

For example, when the Schedule of Values for the contract looks like this:

Contract Schedule of Values showing budget code structure

The presented formula generates this:

Generated document output showing budget code and name formatting

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:

Document template showing filter functionality for Risk Contingency items

Result:

Generated document showing filtered Risk Contingency results

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?

Document template showing contingency cost visibility settings

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

Filter configuration to hide contingency costs from generated documents

The result:

Generated document with contingency costs successfully hidden

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.