Question
· Mar 6, 2020

IRISList.Add doesn't accept Decimals

just wondering - is there any reason why IRISList doesn't accept decimal values?

.. IRISList would be very handy und useful - but if i have to build a wrapper to serilize/ deserilize decimals ...

Discussion (4)2
Log in or sign up to continue

found out about the second; That only affects raw Globals without ClassDefinition...

Obviously a problem of how "Types" are constructed; partly they're embedded in the data; partly it's part of the ClassDefinition?

So just guessing; The problem with storing decimal values is because at the level inserting data via IRISList you don't have info about the Scale-Factor - does this make it impossible to store data internally?

IRISList is a wrapper over InterSystems IRIS $lb structure, and it supports these value types: Int16, Int32, Int64, bool, Single, Double, string, byte[], IRISList.

To be more specific the following datatypes are available.

  • ISO/IEC 8859{1 string. The remainder of the $LIST element is a string of ISO/IEC 8859-1 characters.
  • UNICODE string. The remainder of the $LIST element is a string of UNICODE characters in UTF-16 little endian format.
  • Positive integer. The remainder of the $LIST element is an unsigned integer in little endian order with high order zero octet truncated.
  • Negative integer. The remainder of the $LIST element is a negative integer in twos complement little endian order with high order #FF octet truncated.
  • Positive radix 10 number. The next octet is a signed char that serves as an exponent. That is followed by an unsigned integer in little endian order with high order zero octet truncated. The value of the number is integer × 10exponent.
  • Negative radix 10 number. The next octet is a signed char that serves as an exponent. That is followed by a negative integer in twos complement little endian order with high order #FF octet truncated. The value of the number is integer × 10exponent.
  • IEEE floating point number. Length must allow for either 4 or 8 (preferred) octet of data.

In C# Decimal can be constructed from {Int32, Int32, Int32, Boolean, Byte} and you can use GetBits method to retrieve these parts from Decimal   (docs).