Report Variable


Defines a temporary variable that can hold data in the current report context.

If used outside a report the value will only last for the current page request. Variables can be overwritten further down the page content, but are each unique to a particular report context. Use in conjuction with the Variable Supplier to retrieve variables for use.


NameRequiredAvailable InMigratable to Cloud?Default ValueDescription
Server, Data Center
The name for the variable. Any existing variable in the same context with the same name will be replaced.
Server, Data Center

Either value or a reporter in the macro body must be specified.

This can be a text value or an %injected% value. If the latter, and the whole value is a single %injection%, the actual value will be stored. If it is a mix of text and injections it will be a text value.

Default Value
Server, Data Center
Either a text value or an %injected% value. This will be used if the value/reporter is empty.

Editor View


The body can also be used to store a "reporter", such as Local Reporter or Content Reporter. The report results will be cached and can be reused multiple times on the same page. For example, the following will store the list of pages with the "foo" label in descending order as "foo":


It can then be executed in a report by using Local Reporter:




The same "variable:foo" could be used in other reports on the page, and even have additional "sort" or "filter" macros applied.

It can also be used directly in a Report On or Report Info macro and the results iterated over.

Quick Examples

Setting variables to specific values

In conjunction with the Value Supplier, you can set a variable to a specific text, number or even Confluence content value:

{report-variable:a number|value=%value:number 12345%}
{report-variable:a date|value=%value:date(dd-MMM-yyyy) 25-Nov-2009%}
{report-variable:a page|value=%value:content SPACE:My Page%}

Looping variables

You can set variables up to increment through a report loop.


{report-variable:increment|value=%variable:increment > + 1%|default=%value:number 0%}
h4. {report-info:page:title}

*Increment:* {report-info:variable:increment}


Reusing Reporter configurations

The Query Supplier was added in Reporting 3.3.0. Ensure you have upgraded to use this example.

You can store a reporter query as a variable, either to use via Report Info or to execute in a separate report via Local Reporter.

{report-variable:Page Children}

Random Foo:

{report-info:variable:Page Children > query:as collection > collection:random|link=true}

All Foo Children:

{local-reporter:variable:Page Children}

{report-body}{report-info:page:title|link=true} (Created by {report-info:page:creator|link=true}){report-body}

Tutorial Examples