RAD Studio VCL Reference
TDataSet.Filter Property

Specifies the text of the current filter for a dataset.

property Filter: string;
__property AnsiString Filter;

Use Filter to specify a dataset filter. When filtering is applied to a dataset, only those records that meet a filter's conditions are available. Filter describes the filter condition. For example, the following filter condition displays only those records where the State field is 'CA' or 'MA':

State = 'CA' or State = 'MA'

When a filter is set, Blank records do not appear unless explicitly included in the filter. For example:

State <> 'CA' or State = NULL

When a field name contains spaces, you must enclose the field name in brackets. For example:

[Home State] = 'CA' or [Home State] = 'MA'

Filter expressions on remote SQL tables and on client datasets support field comparisons. For example:

Field1 > Field2

Field comparisons are not supported against local tables (Paradox, dBASE, Access, FoxPro).  

For a complete list of operators you can use in filter strings, see SettingTheFilterProperty.

Note: Filters are not supported on unidirectional datasets. If you set the Filter property of a unidirectional dataset, it raises an exception.
The FilterOptions property controls case sensitivity and filtering on partial comparisons.
Tip: Applications can set Filter at runtime to change the dataset's filtering condition (for example, in response to user input).


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!