Eclipse BIRT Report Object Model (ROM)

FilterCondition Structure

# Structure Overview

Defines a fileter criteria.

### Details

Display Name: | Filter Condition
Since: | 1.0

### Property Summary

expr
  The name of a data row column or an aggregate expression.
filterTarget
operator
  The operator to apply to the expression.
value1
  The first (or only) operand.
value2
  The second operator for between & not between operators.

### Description

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

# Property Detail

## expr Property

The name of a data row column or an aggregate expression.

### Details

Type: | expression
Context: |
Expression Type: | any
Since: | 1.0
Required: | Yes
Display Name: | Expression
JavaScript Type: |
Default Value: | None
Runtime Settable: | No

### Description

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.

## filterTarget Property

### Details

Type: | choice (filterTarget)
Since: | 2.1
Required: | No
Display Name: | Filter Target
JavaScript Type: |
Default Value: | DataSet
Runtime Settable: | No

### Choices

Name | Display Name | Value | Description
DataSet | Data Set | DataSet |
ResultSet | Result Set | ResultSet |

## operator Property

The operator to apply to the expression.

### Details

Type: | choice (filterOperator)
Since: | 1.0
Required: | No
Display Name: | Operator
JavaScript Type: |
Default Value: | eq
Runtime Settable: | No

### Choices

Name | Display Name | Value | Description
eq | Equal to | eq | Relational operator.
ne | Not Equal to | ne | Relational operator.
lt | Less than | lt | Relational operator.
le | Less than or Equal | le | Relational operator.
ge | Greater than or Equal | ge | Relational operator.
gt | Greater than | gt | Relational operator.
between | Between | between | Checks if a value is between two values.
not-between | Not Between | not-between | Checks if a value is not between two values.
is-null | Is Null | is-null | Checks if the value is null.
is-not-null | Is Not Null | is-not-null | Checks if the value is not null.
is-true | Is True | is-true | Checks a Boolean condition. Use these if the expression condition itself already expresses the full filter condition.
is-false | Is False | is-false | Checks if a Boolean condition is false.
like | Like | like | Check the value of a column against a JavaScript regular expression.
top-n | Top n | top-n | Accept the value only if it is within the top n values.
bottom-n | Bottom n | bottom-n | Accept the value only if it is within the bottom n values.
top-percent | Top Percent | top-percent | Accept the value only if it is within the top percentage of values.
bottom-percent | Bottom Percent | bottom-percent | Accept the value only if it is within the bottom percentageof values.
match | Match | match |
not-like | Not Like | not-like |
not-match | Not Match | not-match |

### Description

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, 100
- B, 200
- C, 300
- D, 100
- E, 50
- F, 0

A top-3 ranking would include customers C, B, A and D because A and D both have the same sales amount.

## value1 Property

The first (or only) operand.

### Details

Type: | expression
Context: |
Expression Type: | any
Since: | 1.0
Required: | No
Display Name: | Value 1
JavaScript Type: |
Default Value: | None
Runtime Settable: | No

### Description

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)

## value2 Property

The second operator for between & not between operators.

### Details

Type: | expression
Context: |
Expression Type: | any
Since: | 1.0
Required: | No
Display Name: | Value 2
JavaScript Type: |
Default Value: | None
Runtime Settable: | No

### Description

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 |