Skip to main content

Post 13: iReport: Inserting a heading for a group of records part 1

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 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.


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:




for more information you can refer Post 12: iReport: Creating a simple table of records along with labels for each column

2.  Switch to the Preview tab to see a current preview of your report. You will see a  simple table with an arrangement of records, as shown in the following screenshot:

 

3.  Switch to the Designer tab. Right-click on the top-most element
SimpleGroupWithHeader in the Report Inspector window (on the left side of the Designer tab). A pop-up menu will appear. Click onAdd Report Groupoption in the pop-up menu, as shown in the following screenshot 



4.  A New group wizard dialog will appear as shown follows:

 

5.Type Customer in the Group name field and select CustomerName in Group by the following report object drop-down list, as shown in the following screenshot:

6.  Press the Next button, the dialog will change as shown in the following screenshot:

7.Press the Press the Finish button to dismiss the dialog. You will notice Customer Group Header 1and Customer Group Footer 1 sections have been added into your report, as shown in the following screenshot:

8.  Switch to the Preview tab to see the preview of your report. You will see clear grouping of records based on customer names separated by wide spaces, as shown in the following screenshot:

 9.  Observe each page of your report and concentrate on customer names. You will notice that there are a number of groups for each customer spread randomly throughout the report, as shown in the following screenshot:  

10) Open the Report query window by clicking the report query button to the right of the Preview tab. unfortunately, it is a bit difficult to find this button in iReport as it shows no tool tip when you move your mouse over it. Its icon is similar in shape to a standard database icon and looks like . A Report query window will appear, as shown in the following screenshot:

 

 

Post 13: iReport: Inserting a heading for a group of records  part 2


Comments

Popular posts from this blog

TIME TABLE: VTU BE/B.Tech June/July 2016 Exam Time table Draft Layout

Semester-wise June-July 2016 Exam time table (Draft Layout) Are You Using updated Kwikstudy App?

Walkins Bangalore: 01st-Oct-2016

1. UTC Aerospace : GET – S&IS-Software Team hiring Electronics & CSE / IT Freshers ! Walkin on 1st OCT | BE/BTECH - 2015 & 2016 both batch can try Selection Process : Written Test Group Discussion Technical & HR Interviews How To Apply : It is a walk-in drive for 2016 batch eligible freshers on 1 Oct 2016 at Bangalore location. Interested and eligible candidates can walk-in to the following venue on 1 Oct 2016 Date of Drive : 01 Oct 2016 Reporting Time : 8:00 AM to 11:30 AM Venue : UTC Aerospace Systems – Site 1, Sy. Nos. 14/1 & 15/1, Maruthi Industrial State, Phase 2, Hoody Village, Whitefield Road, K R Puram Hobli, Bangalore – 560048 ______________________________________ 2. HP : Software Eng/ Software Tester (Call based ,less chance of getting entry , try at your own risk) Event Date : 1-October-2016 Event Time : 8 : 00 am Job Location : Bangalore / Chennai Job Description: Software Engineer /

How to get VTU Provisional Degree Certificate (PDC) ?

Here is the procedure to get the Provisional Degree Certificate from the VTU by passed out candidates. You can get the certificate through post by sending the required documents to VTU. Documents and things required: 1. Provisional Degree Certificate (PDC) application form 2. DD of specified fees amount or print copy of receipt if you paid the fees online 3. A letter to the VTU registrar 4. A4 size envelope Step 1: Fill the PDC application You can download the PDC application form from the VTU website. Click below link for application download. PDC application form download     After downloading the application take a print of it and properly fill the form. Step 2: Make a DD of specified amount as the fees of PDC: Go to the bank and make the DD of prescribed fee amount for the PDC. The fee amount is specified in the above link from where you downloaded the application. Make the DD in favor of " Finance Officer, VTU Belgaum ".   Wr