Decimal Descriptor

For questions and postings not covered by the other forums
Wendy
Posts: 2
Joined: Thu Aug 18, 2016 8:10 am

Decimal Descriptor

Postby Wendy » Thu Aug 18, 2016 8:24 am

Hi,
In JadeScript, if a variable of Decimal Type is declared, the method doesnt compile and an error occurs - "Error 7690 - Expecting decimal descriptor".
This error only occurs for decimal datatype, not for integers, strings or boolean
...
vars
str: String;
age: Integer;
salary: Decimal;
begin

end;
.....
I checked Jade error messages - and assume it links with error 1037 (Failed to find class descriptor in superschema). Please advice on how this can be resolved. Thanks

mjagers
Posts: 17
Joined: Wed Sep 22, 2010 5:22 pm

Re: Decimal Descriptor

Postby mjagers » Thu Aug 18, 2016 9:43 am

As its a local variable the decimal needs to define the precision and, optionally, number of decimals.

Try specifying
salary : Decimal [23,2];


Documentation is:
Decimal Type
Use the Decimal primitive type to define a variable with a fixed-precision and decimal point; for example, a monetary value such as a bank balance.

You must specify a decimal descriptor for the integer length of the decimal variable; for example, code d : Decimal [4]; to specify a length of 4. You can optionally specify the number of decimal places for the decimal variable; for example, code d : Decimal [4,3]; to specify that the variable is to be to three decimal places. (If the number of decimal places is not specified, it is assumed to be zero.)

The value of the integer length must be in the range 1 through 23. The number of decimal places must be equal to or less than the length value of the decimal descriptor.

As the decimal value for zero (0) has no fixed precision or scale factor, you can assign this value to any Decimal value. When this value is output (for example, by a write instruction), the scale factor of the property or variable defines the number of decimal places that are displayed. Null decimal values are initialized with a value of zero (0).

When performing decimal arithmetic, only the final assignment result is rounded. For example:

vars
a : Decimal[12,4];
b, tot : Decimal[12,2];

Wendy
Posts: 2
Joined: Thu Aug 18, 2016 8:10 am

Re: Decimal Descriptor

Postby Wendy » Thu Aug 18, 2016 12:53 pm

Thanks :D


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 18 guests

cron