### Applying filters to business/report cubes

When creating reports in JReport Web, you can choose to apply some filter to the specified business/report cube to narrow down the data scope of the business/report cube.

In JReport Web, filter for business/report cubes are defined into two categories: predefined filters and user defined filters. As the name suggests, predefined filters are defined in advance in JReport Designer (for details, refer to Defining and applying business filters in the JReport Designer User's Guide), and user defined filters are created on business/report cubes while they are used in JReport Web.

Filter can be applied to a business/report cube in JReport Web in the following ways:

- Applying a filter to a business/report cube while creating report with the report wizard
  1. In a JReport Web window, click Menu > File > New Report to display the New 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 Standard Banded Object, 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. See the 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 redefined 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 by your own, select User Defined from the Query Filter drop-down list, click the Add Condition button and then define the filter according to your requirements.

     To define a filter:

     1. From the field drop-down list, select the field on which the filter will be based.
     2. From the operator drop-down list, set the operator with which to compose the filter expression.
     3. Type the value(s) of how to filter the field in the value text box, or click the button to specify one or more values in the Select Values dialog.
     4. To add another line of filter expression, click the Add Condition button and define the expression as required, then from the logic drop-down list, specify the relationship between the two filter expressions.
     5. Repeat the above steps to add more filter expressions if necessary.

        To make some conditions grouped, 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. To make any condition in a group out, select it and click Ungroup.

        To adjust the priority of the conditions, select it and click the Up or Down button.

        To delete a condition line, select it and click the Delete button.

     6. When done, click OK to create the filter.
  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 data component into a report
  1. Click Menu > Insert > Banded Object/Table/Crosstab/Chart in a JReport Web window.
  2. Point to the destination, and then click the mouse button.
  3. In the corresponding report wizard, select the required business/report cube for the component, and the fields you want to display in the component.
  4. In the Query Filter screen, specify the filter you want to apply to the business/report cube from the Query Filter drop-down list.
  5. 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 are 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. See the 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.
  4. Click OK to apply the filter to the business/report cube.

Notes:

- Business/report cube filters are defined on component level in JReport Web, which means each time you create a component, you can apply a filter to the business/report cube it applies, and it will not affect other components based on the business/report cube.
- In JReport Web, you cannot edit the predefined filters that have been created on a business/report cube at the Designer side. You can just edit the condition based on a predefined filter and then the edited filter will be saved as a user defined filter.