Applying filters

You can apply filters to business views and data components such as tables, crosstabs and charts of a web report so as to narrow down the data displayed in the web report.

Applying filters to business views

When creating web reports, you can choose to apply some filter to the specified business view to narrow down the data scope of the data component using the business view.

In Web Report Studio, filters for business views are defined into two categories: predefined filters and user defined filters. As the name suggests, predefined filters are defined in advance when creating or editing the business views in JReport Designer, and user defined filters are created on business views while they are used.

Filters can be applied to a business view in the report wizard.

  1. In the Bind Data screen of the Web Report Wizard or in the report wizard, select the business view that you are going to add filters to from the Data Source drop-down list, and then click the Filter button on the right. The Query Filter dialog is displayed. See the dialog.
  2. The dialog has the basic and advanced modes for you to define a filter using either simple expressions or complex expressions.

    When it is in the advanced mode, you can also choose to apply a predefined filter of the specified business view from the Query Filter drop-down list. If you prefer to define a filter on your own, select User Defined from the drop-down list, and then define the filter according to your requirements. You can also edit a predefined filter if required and save it as a user defined filter to the business view.

  3. After you finish the report wizard, the specified filter will be applied to the business view, so that your report will get data that meets the filter condition only.

Note: Query filters take effect on the component level, which means each time you create a component, you can apply a filter to the business view the component uses and it will not affect other components based on the same business view.

Filtering the data components in a report

There are the following ways you can take in order to filter the data components in a web report: using the Filter dialog, using the Filter panel, using the Filter web control, or via shortcut menu.

Using the Filter dialog

When using the Filter dialog to filter report data, you can only make the filter applied to a specific data component in the current web report.

To filter report data using the Filter dialog:

  1. Click Menu > Edit > Filter, or the Filter button on the Standard toolbar. The Filter dialog is displayed. See the dialog.
  2. From the Apply to drop-down list, select the component in the web report to which you want to apply the filter.
  3. Define the filter using either simple expressions or complex expressions.
  4. When done, click OK to apply the filter.

The Filter dialog provides an entry to all the filters used in the current web report except query filters. You can click the Inspector button to view the detailed filter information.

Using filter controls

You can also use the Filter web control to filter one or more data components that use the same data source in a web report. A filter control can do filtering based on one field. For details, see Using filter control to filter report data.

Using the Filter panel

The Filter panel on the left of Web Report Studio is used to filter data components in the current report that are using the same business view. To do this:

  1. Add group and detail resources into the Filter panel by clicking + on the panel title bar. Each added group/detail and its values are housed in a separate box. Group and detail objects can be selected from the business views used by current report.
  2. Select the values you would like to filter the report data. The selected values applies a filter condition to all the data components in the current report that are using the same business view, regardless whether the data components contain the fields holding those values.

    You can make use of the Ctrl or Shift key to do multiple selection.

The value selection applies a filter condition and the logic is as follows:

The following shows more about working with the Filter panel:

You can use the buttons on the bottom of the Filter panel to deal with the value selection in the panel.

After right-clicking on a group/detail name title bar, these options are available for managing the group/detail object.

Notes:

Cascading relationship between filters

The Filter panel can be regarded as a collection of special filter controls which apply to all data components using the same data source. While common filter controls can choose the data components they apply, still under the circumstance of using the same data source.

When there are filter controls, including the special ones in the Filter panel, that apply to the same data components, and when these controls' fields have cascading relationship, the cascading relationship will be revealed when you select values in the controls.

For example, there is a filter control based on the field Country, a filter control on City, and another on State. The first two share one table while the third shares nothing with the other two. In this case, Country and City values will show cascading relationship, but State values will not participate. You select USA in the Country filter control, the values in the City filter control will change as follows if the control has scrollbar: the cities belong to USA are displayed in the upper area of the filter control, and the other cities are put in the lower area and grayed out. For the case that the City filter control has no scrollbar: all the values remain their positions and the values not belonging to USA are grayed out. In both cases all the values are selectable. But the State values remain as before, since the selection of them will not affect the data components that the Country and City filter controls control.

Using the shortcut menu

You can also use filter-related commands on the shortcut menu to filter the data in a table. To do this, point to any value of the field other than the group by field, by which you want to filter data, then right-click to show the shortcut menu. You will see the Filter item which provides a submenu containing the following commands: