Specifies the text of the current filter for a recordset.
property Filter: string;
__property AnsiString Filter;
Use Filter to specify a recordset filter. When filtering is applied to a recordset by setting the Filtered property to true, only those records that meet a filter’s conditions are available to the application. Filter contains the expression used to evaluate the rows in the recordset. At design-time, enter the filter expression into the editing cell for the Filter property within the Object Inspector. At runtime, assign a string containing the filter expression to the Filter property.
The filter expression below displays only those rows where the State field is "CA" or "MA":
State = 'CA' OR State = 'MA'
The following runtime example shows how to assign that filter expression to the Filter property and activate the filtering.
When a filter is set, Blank records do not appear unless explicitly included in the filter. To include rows based on blank, (or "NULL") values in table columns, compare the column to NULL in the expression. For example:
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
The FilterOptions property controls case sensitivity and filtering on partial comparisons.
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!