To add a new report unit, you need a JRXML file, which you can create in iReport beforehand. A report unit has a main JRXML file, a data source, input controls (zero or more), and resources (zero or more).
To create a report unit in the repository:
The ReportUnit Wizard appears.
|
2.
|
In the Naming step, enter an ID, for example, report_unit_example. No spaces allowed. |
|
3.
|
In the Name field, enter a meaningful name. For example, enter Report Unit Example. This name will appear in the repository on the server, and consequently, in the Repository Navigator. |
|
4.
|
In the Description field, briefly describe the report unit. The description will appear in the repository on the server and help users find the report they need. |
|
6.
|
In the Main JRXML step, locate the main JRXML file in the repository or on your hard drive. You can also specify a report that you have open in iReport. |
For example, assume you have a report file named report1.jrxml on your hard drive that you already opened the report in iReport. Select Locally Defined, then click the Get source from current opened report button.
|
8.
|
In the Locate Data Source step, select one of the following options: |
|
•
|
Don’t use any data source |
For this example, select Locally Defined.
|
9.
|
Click the Edit local datasource button. |
The Data Source dialog appears.
|
10.
|
In the Data Source dialog: |
|
a.
|
On the General tab, enter a unique ID. No spaces allowed. For example, enter MyFoodmartDS. |
|
b.
|
In Name, enter a meaningful name. This name will appear in the repository on the server. For example, enter FoodmartDS. |
|
c.
|
On the Data Source Details tab, select a data source type, for example JDBC Data Source, and fill in the required details: |
|
•
|
Driver – org.postgresql.Driver |
|
•
|
URL – jdbc:postgresql://localhost:5432/foodmart |
|
•
|
User name (for the database) – postgres |
|
•
|
Password (for the database) |

|
If you defined the JDBC data source in the currently opened report, you can click the Import from iReport button to help provide these details. Select the data source from the drop-down that you specified during report design. Fill in the port number for the database (5432 for example), and click OK
|
In the figure “Data Source Details”, you'll see the typical details for a JDBC data source.
|
11.
|
In the ReportUnit wizard, click Finish. |
|
12.
|
In the Repository Navigator, expand the Reports folder. The report unit, Report Unit Example, appears: |