The data format for TFMTBCDField
is the TBcd
record from the FMTBcd unit. You can get that raw value by reading the field's Value
or AsBCD
properties.
Depending on what you need the value for, TBcd
might be sufficient. That is, you might not need to convert it to an Int64
. The FMTBcd unit provides functions to add, subtract, multiply, and divide TBcd
values.
The unit provides no conversions to Int64
. There are conversions to Variant
, string
, Currency
, Double
, and Integer
. If we were going to write an Int64
conversion, the Integer
conversion is probably a good place to start, so let's take a look at how it's 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, the VCL itself doesn't provide any more direct way to convert a TBcd
to an Integer
than to go through string
. Therefore, it looks like your idea to call StrToInt64
on the string version of the field is fine.