[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'db' (#fcl)

# TBCDField

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Field class for Binary Coded Decimal (BCD) values

## Declaration

Source position: db.pas line 766

`type TBCDField = class(TNumericField)`
``
`class procedure CheckTypeSize(); override;`
`protected`
`function GetAsCurrency; override;`
`function GetAsFloat; override;`
`function GetAsLongint; override;`
`function GetAsString; override;`
`function GetValue();`
`function GetAsVariant; override;`
`function GetDataSize; override;`
`function GetDefaultWidth; override;`
`procedure GetText(); override;`
`procedure SetAsFloat(); override;`
`procedure SetAsLongint(); override;`
`procedure SetAsString(); override;`
`procedure SetAsCurrency(); override;`
`procedure SetVarValue(); override;`
`public`
`constructor Create(); override;` |  | Create a new instance of a TBCDField class.
`function CheckRange();` |  | Check whether a values falls within the allowed range
`property Value: Currency; [rw]` |  | Value of the field contents as a Currency type
`published`
`property Precision: LongInt; [rw]` |  | Precision of the BCD field
`property Currency: Boolean; [rw]` |  | Does the field represent a currency amount
`property MaxValue: Currency; [rw]` |  | Maximum value for the field
`property MinValue: Currency; [rw]` |  | Minimum value for the field
`property Size;` |  | Number of decimals after the decimal separator
`end;`

## Inheritance

`TBCDField` |  | Field class for Binary Coded Decimal (BCD) values
`TNumericField` |  | Base class for all numerical data field classe
`TField` |  | Provide access to the contents of a single field in a record
`TComponent,IUnknown,IInterfaceComponentReference`
`TPersistent`
`TObject`

## Description

TBCDField is the class used when a dataset must manage data of Binary Coded Decimal type. (TField.DataType equals ftBCD). It initializes some of the properties of the TField class, and overrides some of its methods to be able to work with BCD fields.

TBCDField assumes that the field's contents can be stored in a currency type, i.e. the maximum number of decimals after the decimal separator that can be stored in a TBCDField is 4. Fields that need to store a larger amount of decimals should be represented by a TFMTBCDField instance.

It should never be necessary to create an instance of TBCDField manually, a field of this class will be instantiated automatically for each BCD field when a dataset is opened.

## See also

TDataset |  | Base class for records-based data-access
TField |  | Provide access to the contents of a single field in a record
TFMTBCDField

The latest version of this document can be found at lazarus-ccr.sourceforge.net .