Defines a fileter criteria.
The filter criteria defines a filter to apply to a List, Table, Group or other element. Expressions are of the form "expression op value" or "expression op value 1, value 2". A special case is "expression is true" in which the expression itself is a Boolean expression.
The simplest expression is comparison with a column in the data row:
row.State = "CA"
A slightly more complex comparison is to use a report parameter:
row.State = params.StateParam
Some conditions may require conditional logic:
( row.Balance < 0 || row.Status = "Suspended" ) is true
Note that the "is true" is present just to say that the entire expression should, itself, be treated as a complete condition.
Ranking expressions let the report choose only the most interesting rows:
row.Balance Top 10
Which means to display the ten customers with the highest balances.
When used with groups, a filter can refer to total computed over the group:
Total.sum( row.InvoiceAmt ) > 1000
The filter can also refer to totals computed over the entire data set, or a higher level group. To display only customers whose sales account for at least 5% of total sales:
Total.sum( row.InvoiceAmt ) >= Total.sum_overall( row.InvoiceAmt ) * 0.05
The name of a data row column or an aggregate expression.
The filter expression is the name of a data row column or an aggregate expression. A filter only makes sense when computed using a data row column. BIRT accepts a value such as 1 or "hello, world", but then the same filter criteria will be applied to every row. Such behavior may be useful when testing, but seldom in a production report.
The operator to apply to the expression.
A filter criteria is of the form:
expr op value1 (value2)
The operator says how to test the expression. It can be a simple relational operator:
expr = 10
Or one of the other operations shown above.
The ranking operators (Top N, Bottom N, Top Percent and Bottom Percent) can include ties. For example, suppose we want the top three customers by sales. Suppose we have the following customers and sales:
A top-3 ranking would include customers C, B, A and D because A and D both have the same sales amount.
The first (or only) operand.
The value for simple conditions with the operators: <, <=, =, <>, >=, >, between, not between, like. Gives the "N" for the top N, Bottom N conditions. Gives the "percent" for the Top Percent and Bottom Percent conditions.
The value1
property for a
ranking operator must be constant with respect to the data set. For example, it
can reference a report parameter, but not (normally) a column. The result is
undefined when used with a value that varies within the data set.
Operator | Value 1 |
<, <=, =, <>, >=, > | X |
is null, is not null |
|
between, not between | X (lower bound) |
is true, is false |
|
like | X (the regular expression) |
any | |
top N, bottom N |
X (the n value) |
top percent, bottom percent | X (the % value) |
The second operator for between & not between operators.
The value for conditions with the operators between and not between. Gives the upper value of the range.
Operator | Value 2 |
<, <=, =, <>, >=, > | |
is null, is not null |
|
between, not between | X (upper bound) |
is true, is false |
|
like | |
any | |
top N, bottom N |
|
top percent, bottom percent |