Applying filters

You can apply filters to business/report cubes and data components such as banded objects, tables, crosstabs and charts of a page report so as to narrow down the data displayed in the page report.

Applying filters to business/report cubes

When creating reports in Page Report Studio, you can choose to apply some filter to the specified business/report cube to narrow down the data scope of the business/report cube. 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.

Filters can be applied to business/report cubes in Page Report Studio in the following ways:

Applying a filter to a business/report cube while creating a report
  1. In a Page Report Studio window, click Menu > File > New Page Report to display the New Page Report dialog.
  2. Specify the title of the report as required in the Report Title text box.
  3. In the Choose Report Layout box, select the layout as Banded, Crosstab, Table or Chart and then click OK.
  4. In the corresponding report wizard, select the required business/report cube for the report, and the fields you want to display in the report.
  5. Click the Query Filter screen.

    All the predefined filters of the selected business/report cube 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 screen for you to define either simple or complex filter expressions.

  6. Click Finish in the report wizard and the specified filter will be applied to the business/report cube, so that your report will get data that meets the filter condition only.
Applying a filter to a business/report cube while inserting a data component
  1. In a Page Report Studio window, do either of the following:
  2. In the corresponding report wizard, select the required business/report cube for the component, and the fields you want to display in the component.
  3. In the Query Filter screen, specify the filter you want to apply to the business/report cube from the Query Filter drop-down list, or define a filter according to your requirement.
  4. Click Finish to create the component and the specified filter will be applied to the business/report cube.
Applying a filter to a business/report cube after a report is built
  1. Select the component in a report which was created on a business/report cube 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.
  3. From the Query Filter drop-down list, select the filter you want to apply to the business/report cube used by the component, or define a filter according to your requirement.
  4. Click OK to apply the filter to the business/report cube.

Notes:

Filtering the data components in a report

There are the following ways you can take in order to filter the data components in a page report: 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 to show the Filter dialog. 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: