Types of BIRT filter conditions
Just as with the data source filtering, design different types of BIRT filter conditions depending on how you want to search for data rows. For example, you can specify that BIRT returns rows when the value of a particular field matches a specific value, when the field value falls within a range of values, when the field value matches a string pattern, or when the field value is null.
The filter tool displays operators as English words instead of the actual operators. For example, the tool displays Equal, Greater than, Greater than or Equal, and Not Equal to, instead of ==, >, >=, and !=. Table 12‑2 describes the types of filter conditions supported by the filter tool. The table also contains numerous examples of expressions you can create using the operators. Most operators can be used with different data types.
Table 12‑2 Examples of BIRT filter conditions
Type of filter condition
Description
Example as it appears in the filter tool
Comparison
Compares the value of a field to a specified value.
row["quantity"] Less than 10
row["custName"] Equal "Acme Inc."
row["custName"] Greater than or Equal "P"
row["custState"] Not Equal "CA"
row["orderDate"] Less than or Equal "06/30/05"
Null value
Tests whether a field has a value or not.
row["manager"] Is Null
row["shipDate"] Is Not Null
Range
Tests whether the value of a field falls within a range of specified values. The test includes the endpoints of the range.
row["quantity"] Between 50 and 100
returns all quantities between 50 and 100, including 50 and 100.
row["custName"] Between "A" and "B"
returns all names that start with A.
row["custName"] Not Between "A" and "M"
returns all names that start with M and later letters.
row["orderDate"] Between "06/01/05" and "06/30/05"
returns all dates between these dates, including 06/01/05 and 06/30/05.
Conditional logic
Tests if a complete filter condition evaluates to true or false. Use to create a single filter condition that consists of multiple conditions.
row["country"] == "USA"||row["country"] == "Canada" Is False
returns all countries except the USA and Canada.
row["orderStatus"] == "Open"||row["orderTotal"] > 100000 Is True
returns all orders with open status and all orders with totals exceeding 100000.
Pattern-matching test, using JavaScript syntax
Tests whether the value of a string field matches a specified pattern called a regular expression.
row["custName"] Match /Smith/
returns names that contain the substring Smith.
row["creditRank"] Match /[AB]/
returns credit ranks A or B.
row["productCode"] Match /^S10/
returns product codes that begin with S10.
Pattern-matching test, using SQL syntax
Tests whether the value of a string field matches a specified pattern that uses SQL syntax.
row["custName"] Like '%Smith%'
returns names that contain the substring Smith.
row["productCode"] Like 'S10%'
returns product codes that begin with S10.
Top or bottom n logic
Tests if the value of a specified field is within the top or bottom n values.
row["age"] Top Percent 5
returns ages in the top 5 percent.
row["age"] Bottom Percent 5
returns ages in the bottom 5 percent.
row["orderTotal"] Top n 10
returns the top 10 orders.
row["orderTotal"] Bottom n 10
returns the bottom 10 orders.
Be aware that the filter tool provides two pattern-matching operators: Like and Match. The Like operator enables users who are familiar with SQL to specify pattern-matching expressions using SQL syntax. The Match operator enables users who are familiar with JavaScript to specify pattern-matching expressions using JavaScript’s regular expression syntax.