Applying filters

You can apply some filter to a page report so as to narrow down the data displayed in the report. The filters can be applied to the business/report cubes used by data components such as banded objects, tables, crosstabs and charts in the report, or to the data components themselves.

Applying filters to business/report cubes

For data components created on business/report cubes in a page report, you can apply some filters to the business/report cubes they use to narrow down the data scope of the business/report cubes. Filters for business/report cubes are defined into two categories in Page Report Studio: predefined filters and user defined filters. As the name suggests, predefined filters are defined on business/report cubes in advance in JReport Designer, and user defined filters are created on business/report cubes while they are used in Page Report Studio.

To apply a filter to the business/report cube a data component uses:

  1. Select the component by clicking anywhere in it, and then clicking the icon at the upper left corner of the component.
  2. Click Menu > Report > Query Filter, or right-click the component and select Query Filter from the shortcut menu to display the Query Filter dialog.

    All the predefined filters of the business/report cube the data component uses are listed in the Query Filter drop-down list. Choose the one you want to apply. If you want to further edit the filter, click the Edit button and then redefine the filter as required. The edited filter will then be saved as a user defined filter to the business/report cube.

    If you prefer to define a filter on your own, select User Defined from the Query Filter drop-down list, then define the filter according to your requirements.

    There are the basic and advanced modes of the dialog for you to define either simple or complex filter expressions.

  3. Click OK and the specified filter will be applied to the business/report cube. Only data that meet the filter condition are fetched from the business/report cube and displayed on the data component.

You can also apply a filter to the business/report cube a data component uses in the Query Filter screen of the report wizard while creating the data component.

Notes:

Filtering the data components in a report

When applying filters to the data components themselves in a page report, there are the following ways you can take: using the Filter dialog, using filter controls, using the shortcut menu, and using labels.

Using the Filter dialog

To set the filtering conditions using the Filter dialog:

  1. Click Menu > Report > Filter, or the Filter button on the Analysis toolbar. The Filter dialog appears. See the dialog.

  2. Select the component on which the filtering will be based from the Apply to drop-down list.
  3. Define the filter as required. There are the basic and advanced modes of the dialog for you to define either simple or complex filter expressions.
  4. Click OK to make the filter take effect and return to the report.
Using filter controls

A filter control is a web control used to filter one or more data components, which refer to tables, banded objects, charts, and crosstabs, in a report using the same data source. A filter control can do filtering based on one field. For details, see Using filter control to filter report data.

Using the shortcut menu

You can also use filter-related commands on the shortcut menu to filter the data in a banded object or 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:

Using labels

You can also use a label to control the filter condition in a banded object or table. This feature needs to be enabled at report design time.

  1. In JReport Designer, select a label in a banded object/table, and then set its Filterable property to true.
  2. Set the field by which you want to filter records as the value of the label's Bind Column property.
  3. Save the report and publish it to JReport Server.
  4. Run the report in Page Report Studio, and you can find that a button is beside the label. Click it to show the Filter list, which contains All, Top N, Bottom N, Custom Filter, the field values, and More (if there are too many distinct values for the field), then click the corresponding item to filter the records.

    After applying a filter on the field decided by the Bind Column property, the button will be affixed with a check mark, and you can still click it to show the Filter list, in which the All item can help you remove the filters on the field.

Notes: