Using the Data Chooser Wizard

To design a Domain Topic or a view based on a domain, use the Data Chooser wizard. To open the Data Chooser wizard, click Create > Ad Hoc View. Select Domains, click a Domain, and click Choose Data to access the following pages of the Data Chooser wizard:

The Select Fields PageChoose the fields to make available in the Ad Hoc Editor.
The Pre-filters Page – Define a filter on any field, with the option of prompting for user input, or to compare fields.
The Display Page – Change the order and names of fields that appear in the Ad Hoc Editor.
The Save as Topic Page – Save the settings as a Domain Topic.

You must first select some fields on the Select Fields page, but the other three pages are optional and can be completed in any order. Click Table, Chart, or Crosstab at any time to begin designing a view based on the chosen data.

The Select Fields Page

Use this page to choose fields and sets of fields to use in the view or make available in the Domain Topic:

The Select Fields Page of the Data Chooser Wizard

The Source panel displays the sets of fields in the Domain. Use and to close or expand each set.
The Selected Fields panel shows the items you selected. You can move a field or set back and forth between the panels by dragging, double-clicking, or selecting the item and clicking an arrow button, such as .
If you move an individual field out of a set, it appears in a set of the same name, for example Accounts, as shown in the figure “The Select Fields Page of the Data Chooser Wizard”. If you do not want sets, use the settings on the Display page.
Some Domains define sets that are not joined. When you select a field from such a set, the unjoined sets aren’t available.

The Pre-filters Page

You can pre-filter data in the Data Chooser wizard before clicking Table, Chart, or Crosstab to launch the Ad Hoc Editor or before clicking Save as Topic to create a Domain Topic. Pre-filtering data limits the data choices available in a Domain Topic or the fields that ultimately appear in the Ad Hoc view. You also can define a filter on a field that does not appear in the final report. The filter is still applied and only data that satisfies all defined filters appear in the final report. For example, you can filter data to select a single country, in which case it doesn’t make sense for the Country field to appear as a row, column, or group. You also can design reports that prompt users to input data to use as a filter.

The Pre-filters page provides powerful functionality for designing views within the server.

To define a filter:

1. In the Data Chooser wizard, click Pre-filters.
2. Expand the options in the Fields panel.
3. Double-click to select a field in the Fields panel.

Choices appear for filtering the selected field:

4. Choose a comparison operator.

Text fields have both substring comparison operators such as “starts with” or “contains” and whole string matching such as “equals” or “is one of.” When you select a whole string matching operator, a list appears showing all existing values for the chosen field retrieved in real-time from the database.

In the Filters panel, a drop-down containing the account names appears from which you can select multiple values.

5. Click each value for comparison in Available Values to move it to Selected Values.

If there are more than 50 values to display in Available Values, click to search for the value. The maximum number of items that can be displayed in Available Values is configurable. For details, see the JasperReports Server Administrator Guide.

The account names appear in Selected Values.

6. To limit the view design to the four account names in Selected Values, check the Locked check box:

Condition Editor in the Filters Panel on the Pre-filters Page

By default, the Locked check box is unchecked, making the filter available to end-users when they run the report.

In the Report Viewer, users can click the Options button to enter a comparison value for this condition; when the user clicks Apply or OK, the report preview refreshes with data that match the condition. The condition is available as a prompt even if the filtered field does not appear in the report. For example, the final report might present data for a single country, but the country is chosen by the user. Once defined, filter prompts can be modified in the Ad Hoc Editor, as explained in Using Input Controls.

Note that when the Locked check box is checked, the filter is not available to end-users when they run the report. The condition can only be removed from the view, if needed, but not edited.

7. Click OK to define the filter.

The Filters panel shows the filters you have defined.

8. In the Filters panel, click Change to modify the condition. Click OK to save the changes. After selecting a row, you can also click Remove to delete it from the list.

Data rows must match all conditions. In other words, the overall filter applied to the data is the logical AND of all conditions you have defined.

The Display Page

Use the Display page to change the default label and order of the fields as they should appear in the list of fields in the Ad Hoc Editor. You can always change the field labels and ordering in the Ad Hoc Editor, but setting them here makes them available in a Domain Topic. The page includes these options:

To change the order of fields, click once anywhere in a field’s row and use the Move to top, Move up, Move down, or Move to bottom buttons:

, , , and

Fields may be moved only within their set, but sets as a whole may be also be moved.

By default, the field name becomes the display label for the row, column, or measure that you create from the given field. To change the default display label of a field or set, double-click anywhere in the row and type the new label in the text box.
Sets and the fields they contain appear in the list of fields in the Ad Hoc Editor. Sets are not used in views, but can be used to add all their fields at once, expediting view creation.
If you don’t want to use sets in the Ad Hoc Editor, select Flat List at the top of the Data Source Selection panel. You can now relabel the fields and reorder them.

The Save as Topic Page

On the Save as Topic page, you can enter a name and a description to save the Data Chooser settings as a Domain Topic. Thereafter, you can create different views from the Domain Topic, using its fields, filters, and display label settings. You can also edit the Domain Topic to change the settings.

After you enter a name for the Domain Topic, save it by clicking Table, Chart, or Crosstab from any page in the wizard. The Ad Hoc Editor opens in table, chart, or crosstab mode, respectively, ready to use the fields, filters, and display label settings.
By default, Domain Topics are saved in the standard Topics folder. This corresponds to the Ad Hoc Components > Topics location in the repository; JRXML Topics and Domain Topics in this folder appear on the Topics tab when you start a view. Do not modify this folder name.
The description text appears with the Domain Topic in the repository and at the bottom of the Topics tab on the Ad Hoc Source dialog. Enter an informative description that helps users understand the nature and purpose of this Domain Topic.