JasperReports allows us to group report data in a logical manner. For example, if we were creating a report about cars, we could group the data by car make and/or model. Similarly, if we were creating a report about sales figures, we could group the report data by geographical area.
The FlightStats database we used for the examples in Chapter 4 contains the country, state, and city where an aircraft is registered. Let us create a report displaying aircraft data registered in any state starting with the letter 'A' in the United States. We will group the report data by state abbreviation. The JRXML template for the report follows:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"> <jasperReport name="DataGroupingDemo"> <queryString> <! [CDATA[select a.tail_num, a...