Working with Domains

Working with Domains

This section describes functionality that can be restricted by the software license for JasperReports Server. If you don’t see some of the options described in this section, your license may prohibit you from using them. To find out what you're licensed to use, or to upgrade your license, contact Jaspersoft.

You can create reports based on Domains defined in JasperReports Server. Such reports use data adapters to load data stored in the Domains. To create a Domain-based report, create a data adapter and design a report with its data. Before you create these objects, you'll need a connection to the server. See Connecting to JasperReports Server.

Using the domain Query Language

The domain query language is the default query language for a Domain report. You can create a domain-language query when you first create the report or you can add it later using the Dataset and Query dialog.

To create a Domain-based report when you create a report:

1. Click or select File > New  > JasperReport from the menu. The New Report Wizard is displayed.
2. Select a template and click Next.
3. Select a location to save your report, enter its name, and click Next.
4. Select Domain JRS as the adapter.

The wizard updates to show choices for a server and Domain.

5. Select a server connection from the drop-down.

The Domain drop-down is populated with a list of Domains defined on the server.

6. Select the Domain containing the data for your report. For example, select /public/Samples/Domains/supermartDomain.

Selecting a server and a Domain

7. Select fields or folders in the Domain on the left of the dialog, and drag them to the Fields folder on the right to create fields. You can instead right-click on the item and select Add to Fields. For example, drag Sales > Stores.

The fields are added as a flat list.

Adding fields from a Domain

8. (Optional) Create one or more filters:
a. Drag a single item to the Filters folder., For example, drag Sales > Stores > Region > Country.
b. Choose the comparison operator from the menu, for example, equals.
c. Type the value you want for the filter or click ... to select from a list of available values.
d. If you want to display an input control dialog when the report runs, select Is For Prompting and select a parameter. Click Generate Parameter to have Jaspersoft Studio create a parameter for you.
e. Click OK.
f. Repeat these steps for each filter you want.

Creating a filter for a Domain query

9. When you have the fields and filters you need for your report, click Next.
10. Select the fields to include in your dataset and click Next.
11. Select the fields, if any, for grouping your data and click Finish. The blank report appears in the Design tab.
12. Click OK to create the dataset.
13. Define your report as usual, using the Palette and Outline to add and organize components.
14. Click Preview to test your report. Jaspersoft Studio compiles your report; if it's successful your report is filled and displayed.
15. You will be prompted to publish your report upon save, or click to publish your report. For more information, see Publishing a Report to JasperReports Server.
Version: 
Feedback