319
edits
Changes
→Adding a Variable to an iReport Template
Often it is necessary to add a variable to an iReport template. Variables are used to store calculations and totals in an iReport template. They are often used in the Summary Band portion of a report to store sums of numeric fields (e.g. areaSize) or record counts. There are two main ways to add variables to an iReport template.
For variables that are numeric (area sizes, number of devices, etc):
# From the '''Report Inspector''', Select the field that you wish to sum or count.
#: [[Image:IReport VariableAdd2.png|center|300px|''Select aggregation function'']]<div align="center">''Choose the type of calculation''</div>
This may be required when adding more complicated variables such as variables designed to perform calculations on one or more fields or when using fields that are not numeric.
# From the '''Report Inspector''' '''right click''' on the '''Variable''' tree and choose '''Add Variable'''.
## Enter a '''Variable Expression'''. Normally this is simply selecting the field to be summed or counted (e.g. '''$F{areaSize}''')
#: [[Image:IReport VariableAdd5.png|center|300px|''Edit Variable Expression'']]<div align="center">''Edit Variable Expression''</div>
# Drag the variable to iReport template as desired.