Can Subreport Solve this Issue

Jaspersoft Community 'Read-Only' as of July 8, 2022

Transition to New TIBCO Community Just Weeks Away

You can still search, review wiki content, and review discussions in read-only mode. Please email with questions or issues requiring TIBCO review or response.


I have a scenario below.

I need to print an Invoice together with an acknowledgement letter. (Seperate for each customer)


Sample data

Customer                  Invoice             Date                 Amount

A1                               INV001            01/01/2010     1000

A2                               INV002            03/02/2010      2000

A1                               INV003            03/02/2010      1500


Ineed to print as below

Acknowledgement (first Page)

Customer : A1

INV            Date                   Amount

INV001     01/01/2010       1000

INV003     03/02/2010        1500


after this need to print the above invoices (001 and 003) on seperate pages (page 2 and 3)


Acknowledgement (Page 4)

Customer : A2

INV            Date                   Amount

INV002     03/02/2010       2000


after this need to print the above invoice (002) on next page(page 5)


SO in total the file should be in 5 pages.


Can someone help..? Can subreports do this?

susobh.sugathan's picture
Joined: Mar 30 2015 - 11:12pm
Last seen: 7 years 2 months ago

2 Answers:

You do not need to use sub report to produce the report as per your design requirement. Please take a look at this wiki article for a sample report based on your requirement:


tchen's picture
Joined: Feb 27 2008 - 7:33am
Last seen: 1 day 5 hours ago

Awsome one. Thanks A Lot...

susobh.sugathan - 7 years 3 months ago

Yes this can be done with JasperReport with 1 page and the help of 1 table and 1 subreport.

Main query (dataset):

Here you should make a query and GROUP BY Customer. This way it returns X (is amount of customers) record, and the whole report is repeated X times.

Table on first page:       

You have to define table on the first page. As parameter you should send the 'Customer' and then make a query for that tables that returns all the invoices of that parameter (Customer).


If you preview now, you'll see page 1 and page 4 (from your example)

Subreport on second page

Now you place a subreport on the second page. As parameter you give it 'Customer' as well, and you could use the same query: it returns the report as many times as there are records in teh result.


Good luck with it

gert_1's picture
Joined: Aug 7 2014 - 12:25am
Last seen: 6 years 7 months ago