The data format for TFMTBCDField is the TBcd entry from the FMTBcd module. You can get this raw value by reading the properties of the Value or AsBCD .
Depending on what you need, a TBcd value may be sufficient. That is, you may not need to convert it to Int64 . The FMTBcd module provides functions for adding, subtracting, multiplying, and separating TBcd values.
The unit does not provide Int64 conversions. There are transformations Variant , string , Currency , Double and Integer . If we're going to write an Int64 transform, the Integer transform is probably a good place to start, so let's see how this is implemented:
function BcdToInteger(const Bcd: TBcd; Truncate: Boolean = False): Integer; var ABcd: TBcd; begin if Truncate and (BcdScale(Bcd) > 0) then NormalizeBcd(Bcd, ABcd, Bcd.Precision, 0) else ABcd := Bcd; Result := StrToInt(BcdToStr(ABcd)); end;
So, VCL itself does not provide a more direct way to convert TBcd to Integer than for passing a string . So it seems your idea to call StrToInt64 in the string version of the field is fine.
source share