Previous Page Next Page
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.
- In the report wizard, click the Filter button next to the Data Source drop-down list. The Query Filter dialog appears.
- 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.
- To define a filter using simple expressions:
- Make sure the dialog is in the basic mode.

- Select the field on which the filter will be based from the field drop-down list.
- From the operator drop-down list, set the operator with which to compose the filter expression.
- Type the values of how to filter the field in the value text box, or select one or more values from the drop-down list. You can also click the button
and then select a parameter from the drop-down list to specify the value dynamically and when the available parameters cannot meet your requirement, you can create a local parameter to use in the filter.
- If you want to add another condition line, from the logic operator drop-down list,
- To add a condition line of the AND relationship with the current line, select AND, then define the expression as required.
- To add a condition line of the OR relationship with the current line, select OR, then define the expression as required.
Repeat this to add more filter expressions if required. To delete a condition line, click
on its left.
- To define a filter using complex expressions:
- Switch the dialog to the advanced mode.

- Click the Add Condition button to add a condition line.
- From the field drop-down list, select the field on which the filter will be based.
- From the operator drop-down list, set the operator with which to compose the filter expression.
- Type the values of how to filter the field in the value text box, or select one or more values from the drop-down list. You can also click the button
and then select a parameter from the drop-down list or create a local parameter to specify the value dynamically.
- To add another condition line, click the Add Condition button and define the expression as required. Then click the logic button until you get the required logic to specify the relationship between the two filter expressions. The logic can be AND, OR, AND NOT, or OR NOT.
- Repeat the above steps to add more filter expressions if necessary.
To group some conditions, select them and click the Group button, then the selected conditions will be added in one group and work as one line of filter expression. Conditions and groups together can be further grouped. To take any condition or group in a group out, select it and click Ungroup. It is the equivalent of adding parenthesis in a logic expression.
To adjust the priority of a condition line or a group, select it and click the Up or Down button.
To delete a condition line or a group, select it and click the Delete button.
- 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:
- Click Menu > Edit > Filter, or the Filter button
on the toolbar. The Filter dialog appears.

- 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.
- Define the filter using either simple expressions or complex expressions.
- 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:
- Click + on the title bar of the panel. The Select Field dialog appears.

- 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.
- 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.
- 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.
- 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:

You can use the buttons on the bottom of the Filter panel to deal with the value selection in the panel.
- Back
Goes back to the previous value selection status and refreshes the report data accordingly.
- Clear
Removes all the value selection histories and all the filter conditions based on the selections, and refreshes the report data accordingly.
- Forward
Goes forward to the next value selection status and refreshes the report data accordingly.
For each filter in the panel, you can manage it with the buttons on its title bar or the shortcut menu as follows:

- Search

Displays the quick search toolbar right above the value list for searching the desired values. For detailed usage about the quick search toolbar, refer to Select Values dialog.
- Clear

Cancels the selection of values in the current filter box.
- Clear All
Cancels the selection of all values in the Filter panel.
- Sort

Sorts the values in the ascending or descending order.
- Delete

Removes the filter from the Filter panel and the corresponding filter conditions will be removed from the report too.
Notes:
- Values in a filter box will be removed when the data components that use the same business view as the involved objects of these values are removed.
- When there are more than 300 values for an object, JReport will use Big Data Loading logic. In this case, the Shift Key for multiple selection will not work.
- The filter conditions created via the Filter panel cannot be seen when web reports are opened in JReport Designer.
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:

- Remove Filter
This command is enabled after you have applied filtering on the field. You can click it to remove the filter ever defined on it.
- First N
Filters the field to display only its first N values. You can select a number from the submenu or enter a positive integer into the text box on the submenu to specify the number.
- Last N
Filters the field to display only its last N values. You can select a number from the submenu or enter a positive integer into the text box on the submenu to specify the number.
- Field values
"Field values" is not the name for a command on the Filter submenu, but represents some items which are the values of the field you right-click on. Select a value and the field will be filtered to show only the specified value.
- More
This command is enabled if the Filter submenu cannot list all values of the field. When it is enabled, clicking it brings up the Select Values dialog. Select one value in the dialog and the field will be filtered to show only the selected value.
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.
- Go to the Profile > Customize Profile > Common tab.
- Check the option Filter on Column Headers.
- 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.
- Click OK to save the profile setting.
- Run a web report containing a table in Web Report Studio.
- Put the mouse pointer on any column header and you can find the filter button
.
Click the button a filter list which contains the same items as the Filter submenu appears.

- 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:
- After filtering the data in a table by either shortcut menu, column header or label, you may notice that the corresponding filter expression displays in the Filter dialog if you open this dialog.
- Using JReport Designer, you can specify the default selected component and available components in the Apply to drop-down list of the Filter dialog via the Default for Filter and Invisible for Filter Dialogs properties of the components.
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.
- To save values specified to the on-screen filters in a report as the default values, on the Menu drop-down list, go to Edit > On-screen Filter Values and then select Save as Default.
- To clear the default values that have been saved to the on-screen filters in a report, on the Menu drop-down list, go to Edit > On-screen Filter Values and then select Clear Default.
- To replace the values specified in the on-screen filters in a report with the saved default values, on the Menu drop-down list, go to Edit > On-screen Filter Values and then select Restore to Default.
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
Previous Page Next Page