Options

How to get At least 2 decimal places without rounding the number

jhanvincent14jhanvincent14 Member Posts: 214
all i want is to 0.11 to display at "COGS Percentage" but instead it displays 0.12 (see attached photo)

All help will be appreciated :)

Answers

  • Options
    SowkarthikaSowkarthika Member Posts: 102
    You have to use ROUND function for the variable vdecimal and then assign it to COGS.

    Check https://msdn.microsoft.com/en-us/library/dd301418.aspx to know about using ROUND.
  • Options
    KishormKishorm Member Posts: 921
    If you want more than 2 decimal places on a field (which is what I think you are asking) then you need to clear the AutoFormatType property (if set) and set the DecimalPlaces property to 5:5 - to format to 5 decimal places for example.

    Note you can only format up to 5 decimal places in a field in NAV, you can ream more about this property here...

    https://msdn.microsoft.com/en-us/library/dd338809(v=nav.90).aspx
  • Options
    FiddiFiddi Member Posts: 46
    You should problay use:
    ROUND(VALUE,0.1,'<');
    
  • Options
    vaprogvaprog Member Posts: 1,118
    You don't have a rounding problem here in the first place. There is no (usual) way to round 0.1984... to the shown value of 0.12 . Rounding to two decimal places would give 0,20 .

    By the way, your code is prone to division by zero error.
Sign In or Register to comment.