Grouping report data

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. 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, Creating Dynamic Reports from Databases, contains the country, state, and city where an aircraft is registered. Let's 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 is as follows:

<?xml version="1.0" encoding="UTF-8" ?> <jasperReportxmlns="http://jasperreports.sourceforge.net/jasperreports" ...

Get JasperReports 3.5 for Java Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.