Data.DB.TDataSet.OnCalcFields

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property OnCalcFields: TDataSetNotifyEvent read FOnCalcFields write FOnCalcFields;

C++

__property TDataSetNotifyEvent OnCalcFields = {read=FOnCalcFields, write=FOnCalcFields};

Properties

Type Visibility Source Unit Parent
event public
Data.DB.pas
Data.DB.hpp
Data.DB TDataSet

Description

Occurs when an application recalculates calculated fields.

Write an OnCalcFields event handler to take specific action when an application recalculates calculated fields. A calculated field is one that derives its value from the values in one or more fields in the dataset, sometimes with additional processing.

OnCalcFields is triggered when:

A dataset is opened.

A dataset is put into dsEdit state.

A record is retrieved from a database.

When the AutoCalcFields property is true, OnCalcFields is also triggered when:

Focus moves from one visual control to another, or from one column to another is a data-aware grid control and modifications were made to the record.

Note: When the AutoCalcFields property is true, an OnCalcFields event handler should not modify the dataset (or a linked dataset if it is part of a master-detail relationship), because such modifications retrigger the OnCalcField event, leading to infinite recursion.

If an application permits users to change data, OnCalcFields is frequently triggered. To reduce the frequency with which OnCalcFields occurs, set AutoCalcFields to false.

Warning: When the dataset is the master table of a master-detail relationship, OnCalcFields occurs before detail sets have been synchronized with the master table.

OnCalcFields is an event handler of type Data.DB.TDataSetNotifyEvent.

See Also