From RAD Studio API Documentation
Jump to: navigation, search


property OnFilterRecord: TFilterRecordEvent read FOnFilterRecord write SetOnFilterRecord;


__property TFilterRecordEvent OnFilterRecord = {read=FOnFilterRecord, write=SetOnFilterRecord};


Type Visibility Source Unit Parent
event public
Data.DB TDataSet


Occurs only when a record is fetched from a DB or when the Filtered property is set to True.

Write an OnFilterRecord event handler to specify for each record in a dataset whether it should be visible to the application. To indicate that a record passes the filter condition, the OnFilterRecord event handler must set the Accept parameter to true. To exclude a record, set the Accept parameter to false. Most TDataSet descendants (such as ADO datasets) initialize Accept to true before calling the OnFilterRecord event handler.

Warning: Do not supply an OnFilterRecord event handler to a unidirectional dataset. Unidirectional datasets do not support filters, and assigning an OnFilterRecord event handler causes the dataset to raise an exception.

Filtering is enabled if the Filtered property is true. When an application is processing a filter, the State property for the dataset is dsFilter.

Use an OnFilterRecord event handler to filter records using a criterion that can't be implemented using the Filter property. For example, using the Filter property, field comparisons are not supported against local tables (Paradox, dBASE, Access, FoxPro), but an OnFilterRecord event handler can implement any criterion at all.

Tip: Be sure that any interactions between the Filter property and the OnFilterRecord event handler do not result in an empty filter set when they are used simultaneously in an application.

OnFilterRecord is an event handler of type Data.DB.TFilterRecordEvent.

See Also