Saving the New Report Unit

To submit a new report unit to the repository, click Submit on any page of the JasperReport wizard, from the Set Up page to the Customization page. You don’t have to set options on pages, such as Customization, you do not need. When you click Submit, the server validates the report unit. After clicking Submit, a message appears at the top of the repository page, indicating that the report was successfully saved. The report appears in the repository with the description you entered on the Set Up page. To run the report and view the output, click its name, New Simple Report.

New Simple Report Added to the Repository

Output of the New Simple Report shows the output, only Canadian accounts.

Output of the New Simple Report

In the report viewer, click to go to the end of the report. The logo images that you added as file resources appear.

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 file – the main JRXML
SalesByMonthDetail.jrxml file – a subreport – 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:

Check box

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 > Samples 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 > Samples.
3. Right-click the Samples 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)
     A logo image

In the figure “Suggested Resources for the Complex Report” you can see the list of suggested resources.

Suggested Resources for the Complex Report

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.
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: Logo.

The second suggested resource is added.