You can pre-filter data in the Data Chooser before launching the Ad Hoc Editor or creating 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 can also 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 can also 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, click Pre-filters.
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 appears containing the report status from which you can select multiple values.
5. Click each value for comparison in Available Values to move it to Selected Values. The report status values appear in Selected Values.
- If there are more than 50 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.
6. To limit the view design to the report status chosen in Selected Values, check the Locked check box.
- By default, the Locked check box is unchecked, making the filter available to end-users running 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 running the report. The condition can be removed from the view, if needed, but not edited.
7. Click OK to create 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.