Method EinvoiceDecimal():of() Professional

Creates an EinvoiceDecimal object from a value.

Syntax
:of( <xValue> ) --> oDecimal
Parameters
<xValue>
The value to convert, specified as an EinvoiceDecimal object, NIL, a numeric value or a character string.
Return

An EinvoiceDecimal object with the converted value. If <xValue> is an EinvoiceDecimal object, this object itself is returned.

Description

Converts a value into an EinvoiceDecimal object. This is the usual way to create an EinvoiceDecimal object. All setter methods of the e-invoice classes which accept an amount, a quantity, a price or a rate use this method internally.

The value is converted as follows:

EinvoiceDecimal object - The object is returned unchanged.

NIL or empty string - A new object with the value zero is returned.

Numeric value - The value is converted via a character string with 8 decimal places, so the binary representation of the floating point number is not used directly.

Character string - The string is parsed. Leading and trailing blanks are ignored, an optional leading sign "+" or "-" is accepted, and both "." and "," are accepted as the decimal separator, for example "19.99" or "19,99". Fractional digits beyond the eighth are rounded half away from zero.

For any other value, for example a logical value, an array or a string which is not a decimal number, this method raises a runtime error.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.