Question
Stefan Rieger · 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 ...

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

in addition retrieving values from IRISlist somehow ist strange as well.
there are multiple values i could add to a list but will be retrieved as different types:
long -> int/ or long, depending on the value
short -> int
bool -> int
float -> double
string -> byte[]

will that stay like that or is there room for improvements?

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?

You're right, decimals aren't working properly with IRISList.  We have a fix for this in-process and expect to have it in our mid-year release.

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).