Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sjaak van der Heide 34 posts 106 karma points
    Feb 18, 2021 @ 08:42
    Sjaak van der Heide
    0

    Rounded Decimal value returning 0

    First of all I have to admit I am not 100% sure this is actually Umbraco, but so far I seem to be able to pinpoint it to somewhere in the Modelsbuilder.

    Here is my situation.

    I have to do some calculations with Percentages, so decimals should do the trick here.

    In the backend I made NestedElements so multiple checks can be added. The idea is you can input 2 numbers and it besically gives a specific reply depenting on the percentages between those. So if A < 90% of B if A between 90% & 110% of B if A >110% of B, and such.

    Example

    After running the code and checking the model The min and max will return 0. Modification nicely returns 3,6.

    When I change the min and max to 80,1 and 95,1 they DO return. Already tried manually inputting 80,0 and 95,0 but the ,0 gets stripped on on saving.

    I have 3 options from here ranked from nicest to worst: 1. Fix it so that 80 and 95 get parsed as a Decimal (like they should imo) 2. Fix the backend so it leaves the ,0 on and (assuming here) make it parse as a Dec 3. Change it to a string (with validation) and Parse it manually.

    Is anyone perhaps able to point me in the right direction so I can get this fixed? :D

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies