A Domain is a virtual view of a data source that represents the data in business terms appropriate to your audience. A Domain restricts access to data that is inappropriate for your audience. For more information about Domains, see Creating Domains.
The Domain plug-in enables iReportusers to generate reports from Domains.
To open the Domains Window:
1. | Connect to the server from iReport as described in Connecting to the Server from iReport. |
2. | Click Window > Domains. |
The Domains Window appears on the left-hand side of the screen.
To create a report in iReportbased on a Domain in the server:
1. | To start a report based on a Domain, in iReport, click File > New. |
2. | In the New file window, click Domain Report. |
3. | Accept the default, Blank A4, for the report size, and click Finish. |
The Domain Report wizard opens to the Connection step:
|
Connection Step in the iReportDomain Report Wizard |
4. | Select a connection to a JasperReports Server, then click Next. |
The Domain step displays a selector containing all the Domains within the repository visible to the user defined in the connection.
|
If the user’s organization includes a sub-organization, the list includes any Domains in the sub-organization as well. |
5. | Select a Domain. For example, accept the default Domain, Simple_Domain, and click Next. The Filters step displays the Domain’s items, which may correspond to fields and calculated fields in the Domain. |
6. | Define any necessary filter conditions to apply to the fields of the Domain. For example, expand Opportunities, double-click Amount. In the Condition editor, select is Greater than or equal to. Enter the value 10000, as shown in the figure “Filters Step in the iReportDomain Report Wizard”, and click Add/Update condition. Even if that field is not included in the report, the filter is active and is applied to the rows of data that appear. |
|
Filters Step in the iReportDomain Report Wizard |
7. | Click Next. In the Name and Location step, enter a name and a location on the hard drive to save the report. |
The Name and Location step determines the file name of the report in iReport, not in the JasperReports Server repository. Perform step 10 to step 12 to publish the report in the repository.
8. | Click Finish. |
The report document appears in design area. The Domain Window now shows the sets and items in the Domain.
9. | Drag items from the Domains Window to the detail area of the JRXML in the designer to add them to the report, as shown in the figure “Using a Domain on the Server from iReport”. Edit the report to format its data and its look and feel. |
|
Using a Domain on the Server from iReport |
If you want to change the filters on the Domain data, click Edit Filters in the Domains Window. Filters are defined as queryFilterString elements in the XML of the report. Click XML next to Designer to view the XML.
For the simple filter shown in step 6, the following XML is generated:
<queryString language="domain"> <![CDATA[<query> <queryFields> <queryField id="newSet2.amount"/> </queryFields> <queryFilterString>newSet2.amount >= 10000</queryFilterString> </query>]]> </queryString> |
The query has two elements: queryFields and queryFilterString:
• | Field IDs in both elements are specified as set_ID.field_ID. |
• | The filter uses the Domain Expression Language described in The DomEL Syntax. |
10. | When you are satisfied with the report, save the report, then click Publish Report in the Domain window. |
You are prompted for a name, label, and description of the new report unit.
11. | Enter a name (object ID), label (display name), and an optional description for the report in the repository, then click Next. |
You are prompted for a location for the report unit.
12. | Select a valid repository location and click Finish. |
13. | If the report doesn’t appear in the repository tree, right-click the server name and click Refresh. |
14. | With the report published to the server, you can test it by clicking ![]() |
The report output appears in the report viewer Window.
|
You cannot run a Domain report until it has been published to the server. |