FilterExpression
The FilterExpression object represents the expression that is used to 'find' an item that matches its defined condition. A FilterExpression object contains two fields, an operator and optional a Boolean flag that indicates whether the condition should be evaluated negatively.
Supported Platform(s)
- BlackBerry OS 5.0+ |
- Ripple Emulator |
API | BB5.0 | BB6.0 | BB7.0 | PB1.0 | PB2.0 | BB10 | Ripple |
---|---|---|---|---|---|---|---|
blackberry.find.FilterExpression | Y | Y | Y | Y | |||
leftField | Y | Y | Y | Y | |||
negate | Y | Y | Y | Y | |||
operator | Y | Y | Y | Y | |||
rightField | Y | Y | Y | Y |
Configuration Document Settings
To use all of the API described for this object, you must ensure the following settings are in your configuration document: |
You must declare the feature element(s) below in your configuration document: |
Feature ID | BB5.0 | BB6.0 | BB7.0 | PB1.0 | PB2.0 | BB10 | Ripple |
---|---|---|---|---|---|---|---|
<feature id="blackberry.find" /> | Y | Y | Y | Y |
Permission Elements (PlayBook and BlackBerry 10+) |
---|
This API does not require a <permission> element to be declared in the configuration document of your BlackBerry WebWorks Application. |
Constructors
blackberry.find.FilterExpression
(leftField : Object, operator : Object, rightField : Object, [negate : Boolean])
The FilterExpression object is an instance object, where if a new instance is desired, it must be created using the new keyword.
Supported Platforms | |
---|---|
- BlackBerry OS 5.0+ | |
- Ripple Emulator |
Parameters | |
---|---|
leftField | an object of String or FilterExpression class. |
operator | the operator used for comparing or combining. |
rightField | a value of to be comared or an object of FilterExpression class to be combined. |
negate | optional (default value is false), the flag that indicates whether the condition of the FilterExpression object should be evaluated negatively. |
Code Example:
|
|
|
|
|
|
Properties
readonly
Object
leftField
1. (Either) contains the interested field for "Find." It supports "." to define the subfield to be matched, for example "homeAddress.zipPostal" for a find towards pim.Contact; It also supports the JAM predefined fields for the attribute of Date type (using "."), so the user can "find" towards a Date attribute to match "any appointments that start at 12 o'clock" or "all reminders that will alarm in Oct" without creating complex expression objects.
For example, for a find towards pim.Appointment, if its "start" attribute is a Date of "Dec. 4, 2008 16:30:00"
start.Year - returns a string of 4 digits of the Year value of the date attribute: "2008"
start.Month - returns a string of the Month value: "12"
start.Day - returns a string of the Date value: "4"
start.Hour - returns a string of the Hour value: "16"
start.Minute - returns a string of the Minute value: "30"
start.Second - returns a string of the Second value: "00"
2. (Or) contains another FilterExpression object to be combined with "rightField."
Supported Platforms | |
---|---|
- BlackBerry OS 5.0+ | |
- Ripple Emulator |
readonly
Boolean
negate
The Boolean flag that indicates whether the condition of the FilterExpression object should be evaluated negatively. This should only be used when you have nested expressions. On regular field/value comparisons, negate isn't necessary as the != is sufficient.
Supported Platforms | |
---|---|
- BlackBerry OS 5.0+ | |
- Ripple Emulator |
readonly
Object
operator
Contains the operator, which is either an integer or a string, used for comparing or combining:
0, "!=" - Not equal
1, "==" - Equal
2, "<" - Less than
4, ">" - Greater than
3, "<=" - Equal | Less than (Less or Equal)
5, ">=" - Equal | Greater than (Greater or Equal)
8, "REGEX" - Regular expression. Please refer to java.lang.String.matches() API for details of how to create the correct regular expression and expected behavior.
16, "AND" - AND
32, "OR" - OR
64, "CONTAINS" - CONTAINS
Supported Platforms | |
---|---|
- BlackBerry OS 5.0+ | |
- Ripple Emulator |