To create a report:
| 1. | Click |
| 2. | Expand the Jaspersoft Studio folder and select Jasper Report. Click Next. |
| 3. | In the Report Templates window, scroll to and select the Leaf Green template. Click Next. |
| 4. | In the Report file window, select the MyReports folder and change the Leaf_Green.jrxml file name to Content_Page_One.jrxml. Click Next. |
| 5. | In the Data Source window, select Sample DB – Database JDBC Connection, and enter the following query: |
Select * from orders order by shipcity
| 7. | In the Fields window, select the following Dataset fields to include in your subreport: |
| 8. | Click |
| 9. | In the Group By window, select the SHIPCITY dataset field, then click |
| 10. | Click Finish. The Content_Page_One.jrxml appears in the Design tab. |
| 11. | In the Project Explorer, right-click Content_Page_One.jrxml and select Compile Report. The resulting file, Content_Page_One.jasper, appears in the Project Explorer. |
Adding a Report to the Report Book
Now you can add this new subreport to your report book. During this process, you will specify how the subreport is executed, by assigning a datasource.
To add a report to your report book:
| 1. | Open the Sample_Book.jrxml in the Designer tab. |
| 2. | Drag Content_Page_One.jasper from the Project Explorer into the Content group. |
| 3. | In the Designer tab, click to select Content_Page_One.jasper. |
| 4. | In the Properties view, click Edit Parameters. |
| 5. | In the Report Part Parameters window, click Add to open the Parameter Configuration dialog. |
| 6. | In the Parameter Name field, enter REPORT_CONNECTION. |
| 7. | Click |
| 8. | In the first column, select Parameters. |
| 9. | From the center column, double-click REPORT_CONNECTION parameter connection to add it to the editor field, and click Finish. The expression appears in the Parameter Configuration field. |
| 10. | Click OK and confirm the parameter has been added to the Part Parameters list, then click Finish. |
Recommended Comments
There are no comments to display.