Selecting multiple values for a filter condition
Sometimes you need to view a wider range of data, such as sales details for several sales offices, not only for a single office, as shown in Figure 7‑25.
Figure 7‑25 Selecting multiple values for a filter condition
To select more than one comparison value, select the In operator, choose List Values, then select each value. Use the Previous and Next buttons to navigate the list of values that appears in the Find area. Figure 7‑25 shows the selection of London and Paris from a list of sales office values. Choose OK.
Defining multiple filter conditions
You can add as many filters as you want, but each condition narrows the scope of data further, and adds complexity to the filter. Design and test filters with multiple conditions carefully. As you add filter conditions, Interactive Viewer inserts the logical operator And between each filter expression. You can change this operator to Or. You can also add the Not operator to either the And or Or operators to exclude a small set of data.
When you define more than two conditions, you can use parentheses to group conditions to get the results you expect. For example, A And B Or C is evaluated in that order, so A and B must be true or C must be true to include a data row. In A And (B Or C), B Or C is evaluated first, so A must be true and B Or C must be true to include a data row.
To define multiple filter conditions, use the Advanced Filter dialog box, as shown in Figure 7‑26. You can use Advanced Filter to modify or delete existing filter conditions.
As the example shows, Advanced Filter provides more options for defining a filter with multiple conditions. It also displays all the filter conditions defined for the report table, or chart element.
Figure 7‑26 Adding a filter condition
How to define multiple filter conditions
1 Select and right‑click the report column that contains the values to evaluate, then choose Filter.
2 In Filter, choose Advanced Filter. Advanced Filter appears. Filter By displays the selected column.
3 Define the first filter condition as follows:
1 In Condition, select a comparison operator.
2 In Value, select or type the comparison value. For conditions that test equality and for the Between condition, you can either set a literal value or you can base the value on another data column by selecting the Use value from data field option. For example, you can request actual shipping dates that are greater than the forecast shipping dates, or actual sales that are less than sales targets.
The conditions that support basing the filter value on another column are Equal to, Not Equal to, Less Than, Less Than or Equal to, Greater Than, Greater Than or Equal to, Between, and Not Between.
3 Choose Add Condition.
The filter condition appears in the Filters area, as shown in Figure 7‑27.
Figure 7‑27 Adding or modifying a filter condition
4 Define the second filter condition as follows:
1 In Filter By, select another column.
2 In Condition, select a comparison operator.
3 In Value, select or type the comparison value. You can select Specify literal value, or Use value from data field.
4 Choose Add Condition.
In the Filters area, the second filter condition appears below the first condition, as shown in Figure 7‑27. By default, the second condition is preceded by the logical operator, AND.
5 Choose a different logical operator, if necessary.
6 Add additional filter conditions using the previously outlined method.
7 If you create more than two filter conditions and you use different logical operators, you can use the Parentheses buttons to group conditions and define the order of evaluation of the filter conditions.
8 Choose Validate to verify the syntax of the filter conditions.
9 Select or deselect Recalculate Totals based on whether you want the aggregate data in the report to be modified or not. Choose OK.
10 Verify that the report displays the results you need.
How to modify a filter condition
In Advanced Filter, in the Filters area, select the condition to modify, as shown in Figure 7‑28. Modify the condition by changing the values in Filter By, Condition, or Value fields. Then, choose Change Condition. Select or deselect Recalculate Totals based on whether you want the aggregate data in the report to be modified or not. Choose OK to apply the modified condition.
Figure 7‑28 Changing a filter condition
When working with Interactive Viewer, you can modify filters that you create in Interactive Viewer. Interactive Viewer operates on a report document file generated from a BIRT design, so you cannot modify any filters defined using report designers such as BIRT Studio or BIRT Designer Professional. When you specify a filter condition using Interactive Viewer and save the modified report as a BIRT design file, you must use the report designer tools to modify this filter condition. You cannot modify this filter condition using Interactive Viewer because BIRT Studio and BIRT Designer Professional reapply the filters when you generate the report. Interactive Viewer displays the filtered report document file.
How to delete a filter condition
To delete a condition, select the condition in Filter. Then, select Clear Filter. Choose OK.
To delete an advanced filter condition, in the Filters area in Advanced Filter, select the condition. Then, select Delete.
Verify that the remaining filter conditions are still valid.