Report Variables
Report variables store named values that can be referenced throughout an output template. Instead of repeating the same value or expression in every component, define it once as a variable and reference it with {{var.VariableName}}.
Variables are defined in the Output Designer at the template level. They are not stored in editions — they are evaluated at output render time.
Variable types
| Type | Description | Example |
|---|---|---|
| Static | A fixed literal value entered by the designer | ReportTitle = "Monthly Progress Report" |
| Expression-based | A formula that computes a value from edition fields, parameters, or other variables | BudgetVariance = [ActualCost] - [BudgetCost] |
When to use variables
| Scenario | Use a variable? |
|---|---|
| The same calculated value appears in multiple components (KPI card, table footer, narrative) | Yes — define once, reference everywhere |
| A literal string (report title, client name) appears on every page | Yes — static variable |
| A complex expression would need to be duplicated in 4 chart series | Yes — expression variable |
| A value is used in only one place | No — configure it directly on the component |
| A value changes per edition (report date, period) | No — use an edition field or a parameter |
Defining variables
Step 1 — Open the Variables panel
- Open the blueprint → Output Designer → select the output template.
- In the top bar, click Variables (or press
V). - The Variables panel opens on the right.
Step 2 — Add a static variable
- Click + Add variable.
- Set Type to Static.
- Enter:
- Name — the reference name used in
{{var.Name}}syntax. Must be a single word or camelCase with no spaces. - Value — the literal value (text, number, date, or boolean).
- Data type — Text, Number, Currency, Percent, Date, or Boolean.
- Name — the reference name used in
- Click Save.
Example:
| Setting | Value |
|---|---|
| Name | ClientName |
| Value | Apex Infrastructure Ltd |
| Data type | Text |
Reference: {{var.ClientName}}
Step 3 — Add an expression variable
- Click + Add variable.
- Set Type to Expression.
- Enter:
- Name — reference name (camelCase).
- Expression — formula using field references, functions, and operators.
- Output type — the data type of the result.
- Click Save.
See Expression Reference for the full function library.
Variable syntax
In text components, table cells, KPI labels, page headers, and footers, reference a variable with:
{{var.VariableName}}
In expression fields (other variables, calculated fields, conditional formatting), reference a variable with:
var.VariableName
Do not include {{ and }} when referencing variables inside expression editors — those delimiters are for text interpolation only.
Common variable patterns
Pattern 1 — Report header information
Define static variables for values that appear consistently across the report:
| Variable name | Value | Used in |
|---|---|---|
ClientName | Apex Infrastructure Ltd | Cover page, header footer |
ProjectName | North Station Upgrade | Cover page, every page header |
ContractRef | NRN-2024-042 | Cover page, footer |
PreparedBy | Document Control Team | Cover page |
Reference in a text component: Prepared for: {{var.ClientName}}
Pattern 2 — Computed totals referenced in multiple places
Define an expression variable once and reference it in multiple components:
Variable: TotalActualCost
SUM([sections.CostReport.rows.ActualCost])
This variable can then be referenced in:
- A KPI card value:
{{var.TotalActualCost}} - A table footer:
Total: {{var.TotalActualCost}} - A narrative text component:
Total actual cost to date is {{var.TotalActualCost}}. - Another expression variable:
var.TotalActualCost / var.BudgetAtCompletion
Pattern 3 — RAG summary counts
RedRisks = COUNTIF([sections.RiskRegister.rows.RAGStatus], "Red")
AmberRisks = COUNTIF([sections.RiskRegister.rows.RAGStatus], "Amber")
GreenRisks = COUNTIF([sections.RiskRegister.rows.RAGStatus], "Green")
Reference in a narrative: There are {{var.RedRisks}} critical risks, {{var.AmberRisks}} amber risks, and {{var.GreenRisks}} risks currently rated green.
Pattern 4 — Threshold labels for conditional text
ScheduleLabel = IF([sections.Summary.ScheduleRAG] = "Red", "Behind programme", IF([sections.Summary.ScheduleRAG] = "Amber", "At risk of delay", "On programme"))
Reference in a cover page text block: Schedule status: {{var.ScheduleLabel}}
Pattern 5 — Variance calculation with sign formatting
CostVariance = [sections.Commercial.ActualCost] - [sections.Commercial.BudgetCost]
CostVariancePct = var.CostVariance / [sections.Commercial.BudgetCost]
Reference in a KPI card using the signed_percent format to show +5.2% or -8.4%.
Variable evaluation order
Variables are evaluated in definition order. A variable can reference another variable defined earlier in the list, but not one defined later.
Example (valid — TotalCost defined before VariancePct):
TotalCost = SUM([sections.Cost.rows.ActualCost])
VariancePct = (var.TotalCost - SUM([sections.Cost.rows.Budget])) / SUM([sections.Cost.rows.Budget])
Example (invalid — circular reference):
A = var.B + 1
B = var.A + 1
Circular references cause a render error. Report Forge will flag this with a validation warning in the Variables panel.
Variable naming rules
| Rule | Example |
|---|---|
| Must start with a letter | TotalCost (valid), 1stValue (invalid) |
| No spaces — use camelCase or PascalCase | BudgetVariance, clientName |
| No special characters | CostTotal (valid), Cost-Total (invalid) |
| Case-sensitive | TotalCost and totalCost are different variables |
| Maximum 50 characters | — |
Debugging variables
If a variable reference does not render the expected value:
- Open the Variables panel → check the variable definition for syntax errors (shown with a red indicator).
- Click Preview in the Output Designer — hover over the
{{var.Name}}placeholder to see the resolved value. - Check the data type: a Number variable used in a text context may need explicit formatting with
FORMAT()in the expression. - Check evaluation order: ensure any referenced variable is defined before the current variable in the list.
Related
- Expression Reference — full function library for expression variables
- Parameters and Calculated Fields — parameters vs. variables vs. calculated fields decision guide
- Parameter Strategy — when to use each output-level configuration option
- Running Aggregates — cumulative calculations using running aggregate fields