This section includes an example of how to add a report unit with all these resources:
|
•
|
SalesByMonth.jrxml file – the main JRXML |
|
•
|
SalesByMonthDetail.jrxml file – 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. For more information, see the procedure To remove unwanted parameters from the sample report design.
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 a folder to add the report. For example, navigate to Organization > Reports. |
|
3.
|
Right-click the Reports folder and select Add Resource > JasperReport from the context menu. |
|
Add Resource only appears on the menu if your user account has write privilege to the folder.
|
The Set Up the Report page appears.
|
4.
|
On the Set Up the Report page, 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, the list of suggested resources appears:
|
•
|
A sub-report (the SalesByMonthDetail.jrxml file) |
In “Suggested Resources for the Complex Report” you can see the list of suggested resources.
|
8.
|
On the Controls & Resources page, upload the sub-report: |
|
a.
|
Click Add Now in the same row as SalesByMonthDetail. |
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.
|
In the same row as Logo, click Add Now. |
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. |
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: Logo. |
The second suggested resource is added.