BackPrevious Page Next PageNext

Applying Filters

Applying filters to business views

Filtering the data components in a report

Managing on-screen 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 a web report, you can choose to apply filters to the specified business view to narrow down the data scope of the data component using the business view. Filters for business views are defined into two categories in Web Report Studio: 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.

Business view filters are defined on the component level in Web Report Studio, 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.

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

  1. In the report wizard, click the Filter button next to the Data Source drop-down list. The Query Filter dialog appears.
  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 is applied to the business view. If parameters are used in the filter conditions, they are listed in the Parameters panel and you can specify the parameter values in the panel to dynamically define the filter conditions.

Filtering the data components in a report

To filter the data components in a web report, you can take any of the following ways: using the Filter dialog, using filter controls, using the Filter panel. For tables you can also filter them via shortcut menu, column headers or labels.

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 Filter button on the toolbar. The Filter dialog appears.

    Filter dialog - Basic mode

  2. From the Apply to drop-down list, select the component in the web report to which you want to apply the filter.

    Tip: For web reports created in JReport Designer, the default selected component and available components in the Apply to drop-down list are determined by the Default for Filter and Invisible for Filter Dialogs properties of the components in the web reports.

  3. Define the filter using either simple expressions or complex expressions.
  4. When done, click OK to apply the filter. If parameters are used in the filter conditions, they are listed in the Parameters panel and you can specify the parameter values in the panel to dynamically define the filter conditions.

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

Using filter control

Filter controls can be used to filter one or more data components in a web report. 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. You can create as many filters as you want which resemble filter controls in the panel.

The filters created via the Filter panel are referred to as on-screen filters, the values of which can be saved as the default ones.

To use the Filter panel:

  1. Click + on the title bar of the panel. The Select Field dialog appears.

    Select Field dialog - Filter

  2. The Select Fields box lists all the group and detail objects in the business views used by the current report. Select the objects of the same data type based on which to create the filter.
  3. From the Apply To drop-down list, specify which data components in the report the filter will be applied to.

    By default, JReport applies the filter to all the data components created using the business views in which the selected objects are contained. If you uncheck the data components which are based on the same business view as any selected objects, these objects will not be used in the filter and thus their values will not be listed when the filter is added in the Filter panel.

  4. Click OK. A filter box named by the name of the first selected object in the Select Field dialog is then added in the Filter panel, listing values of the selected objects which are applicable to the specified data components. If the selected objects have values in common, the common values are distinctive in the box.
  5. Select the values with which you want to filter the report data. A filter condition based on the selected values is then applied to the specified data components in the report.

    You can make use of the Ctrl or Shift key to select multiple values. If the values themselves have inter-relationship, after you make the selection, JReport will deal with the rest values to put the related ones on the top and gray the ones that have no relationship with the selected values. The grayed values are still selectable.

The following shows more about working with the Filter panel:

Filter Panel

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

For each filter in the panel, you can manage it with the buttons on its title bar or the shortcut menu as follows:

Filter Panel options

Notes:

Using shortcut menu

For tables you can use the filter-related commands on the shortcut menu to filter the data. To do this, point to any value of a detail 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:

Filter Submenu

Via table column headers

You can use the filter button on any table column header to filter values in the column if the feature is enabled in the server profile. By default, the feature is disabled so you need to configure the profile before you can use it.

  1. Go to the Profile > Customize Profile > Common tab.
  2. Check the option Filter on Column Headers.
  3. Check Show Sort/Filter Status on Column Headers if you want the filter buttons to be displayed on the table column headers after the columns are applied with filter conditions.
  4. Click OK to save the profile setting.
  5. Run a web report containing a table in Web Report Studio.
  6. Put the mouse pointer on any column header and you can find the filter button Filter button. Click the button a filter list which contains the same items as the Filter submenu appears.

    Filter List

  7. Click the required item to filter the column. When a column is filtered its filter button will be highlighted. The summary column that contains multiple aggregation objects cannot be filtered using this way.

Using labels

With JReport Designer, you can bind a label in a table with a field used in the table to enable filtering on the label by setting the label's Bind Column and Filterable properties. Then when running the table in Web Report Studio you can click the filter button beside the label to filter values of the bound field. This functions the same as via the table column headers.

When a label is bound with a field, if the Filter on Column Header feature is also enabled, the former has higher priority. For example, if you bind the label in column A header with the field in column B, when clicking the filter button on column A header, values in column B are filtered.

Tips:

Managing on-screen filters

Filters created via the Filter panel and filter controls in a web report are called on-screen filters. JReport allows you to save values for them as the default values.

Saving and using default on-screen filter values

When the Use Default On-screen Filter Values feature is enabled for web reports in the server profile, each end user can save the values specified to the on-screen filters as the default values for the report and for him. Then the next time when the user runs the report, the saved values will be applied to the on-screen filters by default. The default on-screen filter values work on a user-report basis.

Link relationship between on-screen filters

By default, all the on-screen filters applied to the same data components in a report are interlinked. The link relationship is reflected on the filter values dynamically: selecting a value in one on-screen filter will result in that values which do not belong to the selected value, contain the selected value or relate to the selected value are grayed in all the other linked on-screen filters for distinguishing. For example, there is a filter control based on the field Country and another on City and they both are applied to the same table. When 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. If 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 still selectable.

When using a filter control, you can determine whether or not to make the filter control apply the link relationship via the Link to Other Filters option.

Below is an example showing the logic of other linked on-screen filters:

When

Filter1 is applied to DC1, DC2, and DC3.

Filter2 is applied to DC1.

Filter3 is applied To DC2.

Filter4 is applied to DC2 and DC3.

The result:

For Filter1, other linked filters are Filter2, Filter3, and Filter4.

For Filter2, other linked filter is Filter1.

For Filter3, other linked filters are Filter1 and Filter4.

For Filter4, other linked filters are Filter1 and Filter3

BackPrevious Page Next PageNext