Different decimal representation

Hi All, I would be pleased to know why I experience different results about OData on the sandbox (cloud) and the local environments. I have entity with decimal attribute and I got the 0 value with an scientific notation (0E-8) on SB, but decimal format (0.0000000) on local. In both case the original entered and save value is 0. Note: Formerly I experienced a very similar problems with toString conversation which produced different result in different circumstances. So far I thought it belongs to the Mendix framework version, but now I use the same version (9.15, OData v4) on both environments. Probably it belongs to the configuration or some other environment elements (e.g. RDBMS). Do you have any idea about the different result? Thanks in advance, Istvan
2 answers

Hi Istvan ,


I guess I can't answer your question, but I wanted to share some information.

The expression (0E-8) and (0.0000000) are equal to the same numeric data. 0E-8 means 0*10⁻-⁸ or 0/10000000 these all equal 0.

When you convert this expression to string, you get 0.0000000 data, not 0. To arrange this, you need to determine the number of digits after the point according to your needs.

0.000001 = 1E-7 = 1/10000000 = 1*10⁻-⁷




I’ve not used OData much, but I did have a similar problem a few weeks ago with formatting the output of decimals as Strings. I built a module and put it in the Marketplace called Decimal Tools. The module gives extended versions of the built in parseDecimal and formatDecimal functions with more control over the format of the number. Would it be of use to you here?