Report books are multiple reports or subreports combined into a single report. It combines several sections like cover pages, table of contents, reports, subreports into a book.
This blog provides a walkthrough of the report book creation process, using the sample food mart database.
- Create a new report book by selecting File -> New -> Jasper Report. In the window on the left side, we have the categories, select the Report Books and select Abstract Book and click on Next
- Select the folder and enter the report book name. Select empty data adapter.
- In the next section, all the sections I.e cover page, table of content and back cover page present in the report book will be displayed. Select all the sections and click on finish.
- Open country wise orders book and see the report book structure.
- The first section contains the cover page and table of contents, Second section contains content and the third section contains back cover page.
- In the report book open the dataset and query section, select the food mart database and write a simple query like “Select ‘One’ as one”
- Open the table of contents content section and here we have pre defined labels. We have a maximum of 3 levels.
- The cover page and back cover page reports have some images attached to show on first and last page of the report.
- Do not update any report properties in the report book jrxml like evaluation time.
- Now create a content report.
- Quarter-wise sales – Data are shown in a pie chart
- Sales by Store type and Store type – in a bar chart
- Add bookmarks to titles which can be used as a reference in the table of contents.
- Click on textfield ‘Quarter-wise sales’, select the hyperlink section, open anchors and bookmarks.
- Repeat the above process for another text field.
- Add the report content in the report book. Open report book and go to the content section. Right click and click on ‘Add new book part’. Select an existing report and enter content report either in .jrxml or .jasper
- Use the same data source and add the parameters in the next section if parameters are present.
- Save the report and Preview. The report displayed with cover page, toc, and content.
- In toc, we have two sections.
- Click on Sales by store type and store sales. It should open the report with that section.
- Click on ‘Quarter-wise sales’ and It will open the pie charts.
- Report book is done. Now we can publish this report book into jasper server like a normal report.
In the above image, we can see the book, cover page, toc and back cover jrxmls
It has two reports
Query: select td.quarter, sum(store_sales) sales from sales_fact_1998 sf join time_by_day TD on sf.time_id = td.time_id join store st on st.store_id = sf.store_id and st.store_country = 'USA' group by td.quarter
Query: select st.store_state,st.store_type, sum(store_sales) sales from sales_fact_1998 sf join store st on st.store_id = sf.store_id and st.store_country = 'USA' group by st.store_state,st.store_type
Enter the expression which needs to be displayed on the toc page
Enter the bookmark level (By default jasper toc report has 3 levels)
To format the table of contents page refer to the blog: Table of Content Design Format in Jasper Report
In case if you have any queries please get us at firstname.lastname@example.org
Helical IT Solutions Pvt Ltd
Best Open Source Business Intelligence Software Helical Insight Here
A Business Intelligence Framework
Best Open Source Business Intelligence Software Helical Insight is Here