Skip to main content

TcxCustomFilterControl.FilterText Property

Specifies the text representation of the filter criteria defined by a filter control.

Declaration

property FilterText: string read;

Property Value

Type
string

Remarks

The FilterText property contains a string that describes filter conditions defined by a filter control. Unlike the FilterCaption property, used for display purposes only, a string represented by the FilterText property is composed in compliance with SQL syntax requirements.

Below is an example of FilterText and FilterCaption property values.

FilterText: (State = ‘CA’) AND (PurchaseDate = ‘01-Mar-1976’)

FilterCaption: (State = CA) and (PurchaseDate = 01-Mar-1976)

The FilterText property is particularly important for a filter control of the TcxDBFilterControl type. Since the value of the FilterText property can be applied to a dataset or an SQL statement, you can use it to force a filter control’s linked dataset (specified by the DataSet property) to filter the records itself. When the end-user creates filter conditions by means of the filter control, the value of the FilterText property is constructed automatically. Thus, you can simply assign the FilterText property value to the dataset’s Filter property to apply filtering specified by the end-user.

with cxDBFilterControl1.DataSet do
begin
  Filter := cxDBFilterControl1.FilterText;
  Filtered := True;
end

If a data-aware filter control is bound to a set of data retrieved by a specific SQL query, you can use the FilterText property’s value to compose the required WHERE clause. This clause can then be added to the SELECT statement in code by providing a handler for the OnApplyFilter event.

See Also