Open topic with navigation
Adding a Complex Report Unit to the Server
This section includes an example of how to add a report unit with all these resources:
|
•
|
SalesByMonth.jrxml – the main JRXML file |
|
•
|
SalesByMonthDetail.jrxml – a subreport |
|
•
|
sales.properties – an English resource bundle file |
|
•
|
scriptlet.jar – a scriptlet class JAR file |
|
•
|
JR Logo – an image in the repository |
|
•
|
JServer JNDI data source – a data source file in the repository |
These resources are part of the sample data installed with the server. To complete this example and run the report without server errors, you need access to these resources.
The example also guides you through defining every type of input control:
If you’re not interested in creating all types of input controls, but want to work through part of the example, delete parameters for the input controls you don’t create before you run the report.
The complex report you create in this example is almost exactly like the SalesByMonth report in the Reports folder of the repository.
To upload the main JRXML and suggested resource files for the complex report unit:
|
1.
|
Log into JasperReports Server as administrator and select View > Repository. |
|
If you log in as a user, you can upload a report unit to the server, but this example requires an administrator login to access the image resources.
|
|
2.
|
Navigate to the folder containing your report. For example, navigate to Organization > Reports. |
|
3.
|
Right-click the Reports folder and select Add Resource > JasperReport from the context menu. The Set Up the Report page appears. |
|
Add Resource appears on the menu only if you have write privilege to the folder.
|
|
4.
|
Enter these properties: |
|
•
|
Name – New Complex Report |
|
•
|
Resource ID – New_Complex_Report |
|
•
|
Description – This is a complex report |
|
5.
|
Select Upload a Local File. |
|
6.
|
Click Browse to locate the file <js-install>/samples/reports/SalesByMonth.jrxml. |
|
7.
|
Click Controls & Resources. |
On the Controls & Resources page, “Suggested Resources for the Complex Report”, suggests resources to be uploaded for the report:
|
•
|
A sub-report (the SalesByMonthDetail.jrxml file) |
|
8.
|
On the Controls & Resources page, upload the sub-report: |
|
a.
|
Click Add Now in the SalesByMonthDetail row. The Locate File Resource page appears. |
|
b.
|
Select Upload a Local File. |
|
c.
|
Click Browse and locate the file <js-install>/samples/reports/SalesByMonthDetail.jrxml. Select SalesByMonthDetail.jrxml. |
The path to SalesByMonthDetail.jrxml appears in the Upload a Local File field.
|
d.
|
On the Locate File Resource page, click Next. |
|
e.
|
On the Add a Report Resource page, click Next to accept the default report resource name and resource ID. |
|
9.
|
On the Controls & Resources page, upload the logo image resource: |
|
a.
|
Click Add Now in the Logo row. The Locate File Resource page appears. |
|
b.
|
On the Locate File Resource page, click Select a resource from the Repository. |
|
c.
|
Click Browse to locate the file /Images/JR Logo and select JR Logo. |
|
d.
|
Click Next. The Add a Report Resource page appears. |
|
e.
|
On the Add a Report Resource page, click Next to accept the default name, resource ID, and description. |
Open topic with navigation