The comparison operator in criteria may be >
(greater than), <
(less than), =
or ==
(equal), >=
(greater than or equal), <=
(less than or equal), <>
or !=
(not equal), or like
or ~
(pattern matching).
You can use AND
in the specifying search criteria to join multiple filters. For example, you join the two valid filters "a < b
" and c < d
with "a < b and c < d
". Do not use an expression like "a AND b
". It is an invalid expression, since "a
" and "b
" are not valid expressions on their own.
The value in criteria may be a string, number, date, or true
. String values may be delimited with single quotes or #
(number sign); for example, "state = 'CA'"
or "state = #CA#"
. Date values are JavaScript date.toString( )
formatted; for example, #Wed Apr 17 14:18:14 GMT+0000 2002# or #Wed Apr 17 14:18:14 GMT-0700 (Pacific Daylight Time) 2002#)
. Dates can also be specified as a number corresponding to the value returned from a JavaScript Date
object getTime( )
.
If the comparison operator is like
or ~
, the string value may contain an asterisk (*
) to find one or more occurrences of any character or substring. For example, "state like 'C*'"
matches California and Colorado. You can also use leading and trailing asterisks to find a substring contained within the
values. For example, "state like '*as*'"
matches Alaska, Arkansas, and Massachusetts.
Asterisks can be used only at the end of a criteria string, or together at both the beginning and end of a criteria string,
as shown above. You cannot use the asterisk as a leading wildcard ('*str'
), or embedded wildcard ('s*r'
). String comparisons are not case sensitive. If you specify like
and do not include any asterisks, then *value*
is assumed.
The comparison operator $=
will do a case-sensitive string search.
The following are all valid JavaScript examples of search criteria:
myDate = new Date(2002, 10, 23); search = myDBSet.createSearch("startDate >= " + myDate); search = myDBSet.createSearch("startDate >= " + myDate.getTime()); search = myDBSet.createSearch("address like #park lane#"); search = myDBSet.createSearch("name == 'David'"); search = myDBSet.createSearch("city == Chicago"); search = myDBSet.createSearch("zipcode >= 90302"); search = myDBSet.createSearch("hasPaid == true"); search = myDBSet.createSearch("city $= Chicago"); |
Send feedback about this page using email. | Copyright © 2008, iAnywhere Solutions, Inc. |