procedure TFMTBcdFactory.CastTo(var Dest: TVarData; const Source: TVarData; const aVarType: TVarType); var v: TVarData; begin if Source.vType=VarType then if aVarType = varString then VarDataFromStr(Dest, BCDToStr(TFMTBcdVarData(Source.vPointer).BCD)) else begin VarDataInit(v); try v.vType:=varDouble; v.vDouble:=BCDToDouble(TFMTBcdVarData(Source.vPointer).BCD); VarDataCastTo(Dest, v, aVarType); //now cast Double to any requested type finally VarDataClear(v); end; end else inherited; end;