Inserting a heading for a group of records
You may need to display headings for a subset of records in your report at certain places. For example, if you are generating a weekly or monthly report of all customer invoices, you may
want to display a heading for each subset or group of records corresponding to an individual customer. This is sometimes convenient, as it allows you to generate just one report (that is,
a report of all invoices issued in a month), which actually consists of many reports (that is, a report for each of your customers).
JasperReports offers an interesting feature known as grouping of records, which you can use to do many tricks in report designing. This recipe demonstrates how to use the grouping feature to generate a dynamic heading for a group corresponding to a customer name in your report.
Getting ready
Refer to the post named Copy Sample Data Into Postgres which helps you to create a database named jasperdb2 and copy sample data for this post into the database.
How to do it...
1. Create the SimpleGroupWithHeader.jrxml file such that Designer tab of iReport shows a report with a title Māsika Customer Invoices, as shown next:
3. Switch to the Designer tab. Right-click on the top-most element
You may need to display headings for a subset of records in your report at certain places. For example, if you are generating a weekly or monthly report of all customer invoices, you may
want to display a heading for each subset or group of records corresponding to an individual customer. This is sometimes convenient, as it allows you to generate just one report (that is,
a report of all invoices issued in a month), which actually consists of many reports (that is, a report for each of your customers).
JasperReports offers an interesting feature known as grouping of records, which you can use to do many tricks in report designing. This recipe demonstrates how to use the grouping feature to generate a dynamic heading for a group corresponding to a customer name in your report.
Getting ready
Refer to
the Post6: iReport: Installation of PostgreSQL, which shows how you can install and run
PostgreSQL. Note that your installation of PostgreSQL should be up and running
before you proceed.
How to do it...
1. Create the SimpleGroupWithHeader.jrxml file such that Designer tab of iReport shows a report with a title Māsika Customer Invoices, as shown next:
Comments
Post a Comment