Decimal params

Hello,

I am using RemObjects SDK 10.0.0.1469 for Delphi.

I try to use an decimal param for a service method.
Service Builder generate interfaces and this paramter is declared as Decimal.

But when this metod is invoked, decimal param is deserialized as TDecimal and in my method this param is received as “variant array of bytes” and can not be directly used as numerical values.

Best Regards

Hi,

you can use these methods of uROBinaryHelpers.pas:

function DecimalToBCD(const aDecimal: TDecimal): TBcd;
function DecimalToString(const aDecimal: TDecimal; aDot: Char): string;
function DecimalToVariant(const aDecimal: TDecimal): Variant;
function DecimalVariantToString(const aVariant: Variant): string;
function VarByteArrayToDecimal(const aVariant: Variant; var aDecimal: TDecimal): Boolean;

Ok.
Thanks.
This is a bug or is “as designed”?

Decimal itself is an array of Cardinal:

TDecimal = array[0..3] of Cardinal;

we can’t store it as is to variant so we use variant array of byte for storing it:

function DecimalToVariant(const aDecimal: TDecimal): Variant;
begin
  Result := DecimalToVarByteArray(aDecimal);
end;

so it is as designed.

you can use VariantToBCD method for working with this decimal variant