Filtering report data

In JReport Web, data is cached in a data buffer. You can set a series of conditions and apply them to a DHTML server to filter the data buffer and reproduce the report result.

There are three methods you can use to set the filter conditions: using the Filter dialog, using the shortcut menu, and using labels. However, when you are to filter a crosstab or chart, you can only use the Filter dialog. The other two methods do not apply to crosstabs and charts.

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. Click the Add Condition button to add a filter line.
  4. From the field drop-down list, select the field on which the filter will be based.
  5. From the operator drop-down list, set the operator with which to compose the filter expression.
  6. Type the value(s) of how to filter the field into the value text box, or click the button to specify one or more values in the Select Values dialog (for details about how to define values in the dialog, refer to Select Values dialog).
  7. 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.
  8. 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 you have already added, select the condition and click the Delete button.

    To retrieve the opening status of this dialog, click Reset.

  9. Click OK to make the filter take effect and return to the report.

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 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 set and publish it to JReport Enterprise Server.
  4. Run the report set in JReport Web, 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: