6.8. Variables

A report can declare a number of variables. Variables represent named expressions that are used to store some global objects or perform various calculations. Once declared, they can be referred to in other expressions using a dedicated syntax. JasperAssistant groups these declarations under a single Variables node in the Outline View. New variables can be added by using the context menu associated to this node.

Variables can perform built-in types of calculations like: count, sum, average, lowest, highest, variance, etc.

For variables that perform calculations, a reset type can be specified. A reset type indicates the moment of report execution at which the variable is reinitialized. The default reset type is Report and it indicates that the variable is initialized only once at the beginning of the report, and that it performs the specified calculation until the end of the report is reached. Other reset types can be specified in order to perform calculations at page, column or group levels.


In its expression, a variable can reference other report variables, but only if those referenced variables were previously defined. This means that the order in which the variables are declared is important.

Variable Properties