RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomCachedDataSet.AutoCalcFields Property

Determines when the OnCalcFields event is triggered and when lookup field values are calculated.

Pascal
property AutoCalcFields: Boolean;
C++
__property Boolean AutoCalcFields;

Set AutoCalcFields to control when the OnCalcFields event is triggered to update calculated fields and when lookup fields are calculated. 

A calculated field is one that derives its value from the values of one or more fields in the active record, sometimes with additional processing. Lookup fields are fields whose values come from a secondary dataset or lookup cache.

Note: Unidirectional datasets support calculated fields but not unidirectional fields. For unidirectional datasets, OnCalcFields only controls when calculated fields are updated.
When AutoCalcFields is true (the default), Lookup fields are recalculated and OnCalcFields is triggered when: 

The dataset is opened. 

The dataset is put into dsEdit state. 

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

When AutoCalcFields is false, Lookup fields are recalculated and the OnCalcFields event occurs only when 

The dataset is opened. 

The dataset is put into dsEdit state. 

A record is retrieved from a database. 

If an application permits users to change data, OnCalcFields is frequently triggered. In these cases an application may set AutoCalcFields to false to reduce the frequency with which the OnCalcFields event occurs and with which lookup values are fetched. 

 

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