RAD Studio VCL Reference
|
Specifies the text of the current filter.
property Filter: string;
__property AnsiString Filter;
Use Filter to specify a dataset filter. When filtering is applied to a client dataset, only those records that meet a filter's conditions are available to an application. Filter contains the string that describes the filter condition. Client datasets support the following set of filter operations: See the Limiting what records appear link at the bottom of this topic for a complete list of available filter operations.
Operator or function ComparisonsExampleComment
Operator or function Comparisons |
Example |
Comment |
= |
State = 'CA' |
|
<> |
State <> 'CA' |
|
>= |
DateEntered >= '1/1/1998' |
|
<= |
Total <= 100,000 |
|
> |
Percentile > 50 |
|
< |
Field1 < Field2 |
|
BLANK |
State <> 'CA' or State = BLANK |
Blank records do not appear unless explicitly included in the filter. |
IS NULL |
Field1 IS NULL |
|
IS NOT NULL |
Field1 IS NOT NULL |
|
Logical operators |
|
|
and |
State = 'CA' and Country = 'US' |
|
or |
State = 'CA' or State = 'MA' |
|
not |
not (State = 'CA') |
|
Arithmetic operators |
|
|
+ |
Total + 5 > 100 |
Applies to numbers, strings, or date (time) + number |
- |
Field1 - 7 <> 10 |
Applies to numbers, dates, or date (time) - number |
* |
Discount * 100 > 20 |
Applies to numbers only |
/ |
Discount > Total / 5 |
Applies to numbers only |
String functions |
|
|
Upper |
Upper(Field1) = 'ALWAYS' |
|
Lower |
Lower(Field1 + Field2) = 'josp' |
|
Substring |
Substring(DateString,8) = '1998' | Substring(DateString,1,3) = 'JAN' |
Value goes from position of second argument to end or number of chars in third arg. First char has position 1. |
Trim |
Trim(Field1 + Field2) | Trim(Field1, '-') |
removes third argument from front and back. If no third argument, trims spaces. |
TrimLeft |
TrimLeft(StringField) | TrimLeft(Field1, '$') <> '' |
See Trim |
TrimRight |
TrimRight(StringField) | TrimRight(Field1, '.') <> '' |
See Trim |
DateTime functions |
|
|
Year |
Year(DateField) = 2000 |
|
Month |
Month(DateField) <> 12 |
|
Day |
Day(DateField) = 1 |
|
Hour |
Hour(DateField) < 16 |
|
Minute |
Minute(DateField) = 0 |
|
Second |
Second(DateField) = 30 |
|
GetDate |
GetDate - DateField > 7 |
Represents current date and time |
Date |
DateField = Date(GetDate) |
Returns the date portion of a datetime value |
Time |
TimeField > Time(GetDate) |
Returns the time portion of a datetime value |
Miscellaneous |
|
|
Like |
Memo LIKE '%filters%' |
Works like SQL-92 without the ESC clause. When applied to BLOB fields, FilterOptions determines whether case is considered. |
In |
Day(DateField) in (1,7) |
Works like SQL-92. Second argument is a list of values all with the same type. |
* |
State = 'M*' |
Wildcard for partial comparisons |
Limiting Which Records Appear
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|