Error Conditions with Predicates
To be used as a filtering predicate, a predicate expression must evaluate to a Boolean value (true or false). TIBCO Patterns responds with an error if a filtering predicate expression is unable to produce a Boolean value. For example, the predicate expression:
DATE $“Creation Date”
is not valid as a filtering predicate, since it never produces a Boolean result.
On the other hand, even well-formed Boolean predicates might fail to evaluate true or false for some records. Consider the following predicate expression where Clicks is an integer field:
$“Clicks” > 50
Since it is a Boolean expression, it is accepted as a filtering predicate. But the success of the evaluation depends on the integer value in the field Clicks. If a record is loaded with the value “123” in the Clicks field, the predicate evaluates to true. If a record was loaded with the value “21”, it evaluates to false.
The predicate evaluation fails if:
| • | The value stored in the table is the special "invalid" value. For example, if the value passed in for the "Clicks" field of the record was "orange", this is mapped to the special invalid value and the predicate evaluation fails on this record. |
| • | If the value stored in the table is the special "empty" value. For example, in the example, $“Clicks” > 50, if the "Clicks" field for the record was empty. |
By default, if a filtering predicate expression fails to evaluate for a given record, that record is rejected from the search. In other words, the predicate expression selects only those records that evaluate to true, and excludes records that fail to evaluate as well as the records that evaluate to false.
In some cases, however, it might be required to retain records in the search that have “empty” or “invalid” values in the field referenced by a filtering predicate. Using search options, you can control the behavior of filtering predicates in these cases.
The rules for dealing with "empty" and "invalid" values are:
| • | By default, if a referenced field contains an empty or invalid value, the record is rejected. |
| • | The user can specify that empty values should not be rejected, instead the predicate expression is evaluated with the empty value using the rule that "{empty}" < "{any valid non-empty value}". |
| • | The user can specify that invalid values should not be rejected, instead the expression must be treated as if it returned true. |
See TIBCO® Patterns Programmer’s Guide for further details.