Data.DB.TField.Calculated

From RAD Studio API Documentation
Jump to: navigation, search

[–] Properties
Type: property
Visibility: public
Source:
Data.DB.pas
Data.DB.hpp
Unit: Data.DB
Parent: TField

Delphi

property Calculated: Boolean read GetCalculated write SetCalculated default False;

C++

__property bool Calculated = {read=GetCalculated, write=SetCalculated, default=0};

Description

Determines whether the value of the field is calculated by the OnCalcFields event handler of its dataset.

Use Calculated to determine if the field is a calculated field. When Calculated is True and the OnCalcFields event occurs, the OnCalcFields event handler updates the value of the field. The default value is False.

The value of a Calculated field is not stored in or retrieved from the physical tables underlying a dataset. Instead, calculated fields are calculated for each record in the table by the dataset's OnCalcFields event handler, which typically uses expressions involving values from other fields in the record to generate a value for each calculated field.

For example, a dataset might have non-calculated fields for Quantity and UnitPrice, and a calculated field for ExtendedPrice, which would be calculated by multiplying the values of the Quantity and UnitPrice fields in an OnCalcFields event handler.

Note: Do not change the setting of Calculated in application code. Calculated is automatically set to True by the Fields editor at design time if a field's value is specified as calculated.

Note: Do not confuse the Calculated property with the InternalCalcField property of a field definition. The value of a calculated field is computed in the OnCalcFields event handler. The value of an internally calculated field is computed by the SQL server or the Borland Database Engine.

See Also