Sometimes we would like to display related charts or crosstabs for similar data grouped differently. For example, in the previous section we generated a crosstab displaying the total number of aircraft of a particular set of models in the state of New York. We can display the same set of data for different states by using subdatasets. The following example illustrates how to do this.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design// EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport name="DatasetDemoReport" leftMargin="5" rightMargin="5">
<subDataset name="Aircraft_Models">
<parameter name="StateParam" class="java.lang.String"/>
<queryString>
<![
CDATA[select
a.city, am.model, a.tail_num
from aircraft a, aircraft_models am
where a.state=$P{StateParam} and...