Quantcast
Channel: NAV Three Tier — mibuso.com
Viewing all articles
Browse latest Browse all 10032

.NET Decimal -> COM -> VT_DECIMAL -> Unknown

$
0
0
Hi there

I wrote a .NET assembly which has a COM Interface so I can call it from NAV.

I noticed that .NET decimal type gets marshalled to VT_DECIMAL... but the poor NAV classic client doesn't know what VT_DECIMAL is (VT_UNKNOWN).

According to the help...the NAV type Decimal is mapped to VT_Currency and...
The CURRENCY type in COM is a special data type with a fixed point, which has 15 digits to the left of the point and 4 to the right. You should note that the Decimal type in C/AL does not have a fixed point and can have a total of 18 digits. This could possibly lead to some rounding being performed when a Decimal number is passed to a method that expects a CURRENCY, the server manipulates that number and returns it as a CURRENCY. No matter how many digits the original Decimal had to the right of the decimal point, the returned CURRENCY will have no more than 4 digits.

So my question is:
is there a better way than marshalling the .NET Decimal type to VT_Currency?
Since I'm using my .NET assembly also in the newer versions of NAV with .NET Interop ... I want to keep the decimal datatype in .NET... since that works fine.

Anyone?

Viewing all articles
Browse latest Browse all 10032

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>