Java Reference
In-Depth Information
Attribute
Description
Valid Values
Default Value
resetType
Determines when
the value of a
variable is reset.
Column : The variable value
is reset at the beginning of
each column.
Group : The variable value
is reset when the
group specified by
incrementGroup changes.
None : The variable value is
never reset.
Page : The variable value is
recalculated at the beginning
of every page.
Report : The variable value
is recalculated once, at the
beginning of the report.
Report
resetGroup
Determines the
name of the
group at which
the variable value
is reset, when
resetType
is Group .
The name of any group
declared in the JRXML report
template.
N/A
As can be inferred from the table, JasperReports variables can be used not only to
simplify report expressions, but also to perform calculations, and to display the
result of those calculations on the report.
Let us modify the report we developed in the previous section so that it displays the
total number of aircraft in each state. To accomplish this, we need to create a report
variable and set its calculation attribute to Count . The following JRXML template
illustrates this concept:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN"
"http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport name="VariableCalculationDemo">
<queryString>
<![CDATA[select a.tail_num, a.aircraft_serial, am.model, a.state
from aircraft a, aircraft_models am
where a.aircraft_model_code = am.aircraft_model_code
and a.country = 'US' and state like 'A%'
Search WWH ::




Custom Search