Java Reference
In-Depth Information
Crosstab (cross-tabulation) reports are reports containing tables that tabulate data
across rows and columns. This feature was introduced in JasperReports 1.1. The
following example illustrates the use of crosstab in a report. The JRXML template
the use of crosstab in a report. The JRXML template
will generate a report displaying a table containing the number of aircraft in each city
in the state of New York. The last column of the table will display the total number
of aircraft for all models in the table in each city. The last row will display the total
number of aircraft of each model in the table. To avoid having an unmanageable
number of columns in the table, we will limit the report to aircraft models that start
with the letter C .
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//
EN" "">
<jasperReport name="CrossTabDemoReport" leftMargin="5"
<![CDATA[select, am.model, a.tail_num
from aircraft a, aircraft_models am
where a.state='NY' and am.model like 'C%'
and a.aircraft_model_code = am.aircraft_model_code
order by city, model]]>
<field name="tail_num" class="java.lang.String"/>
<field name="model" class="java.lang.String"/>
<field name="city" class="java.lang.String"/>
<band height="60">
<reportElement width="782" y="0" x="0" height="60"/>
<rowGroup name="cityGroup" width="100" totalPosition="End">
<bucketExpression class="java.lang.String">
<box border="Thin" borderColor="black"/>
<reportElement width="100" y="0" x="0" height="20"/>
Search WWH ::

Custom Search