Round decimal field in report

Hi experts!

I have a decimal field with 5 decimal digits, but on my report, I would like NAV 2009 to round or truncate the value to 2 digits (from 1.23456 to 1.23).

I have tried to set the property DecimalPlaces to "<2:2>" and "2:2", but it still shows too many decimal digits. When I print the value 42, it is shown nicely as "42.00".

How do I tell NAV to round or truncate the value?

Answers

  • MortenSteengaardMortenSteengaard Member Posts: 136
    Thanks a lot BlackTiger. I'll look into this next week.

    I forgot to write that the report is made using the "Sections" and not "Layout". Is your answer still correct?
  • vaprogvaprog Member Posts: 1,144
    Hi,

    it's not quite clear what you want to achieve. First you say
    I would like NAV 2009 to round or truncate the value to 2 digits (from 1.23456 to 1.23).
    Then tell us, your unsatisfactory result is
    it is shown nicely as "42.00"

    I count those ".00" as two digits, just as you specified.

    If you don't want those zeros at the end, you may use 0:2 as your value for the DecimalPlaces property. (The value means: round the value to two decimal places, then show at least zero and at most 2 digits after the decimal separator, removing trailing zeros)

    NAV shows default values surrounded with angle backets (i.e. the <2:2>). You do not enter those, if you specify a value. In fact, in most cases this is an error.

    You do not need to ROUND() your value, DecimalPlaces takes care of this (for display only, it does not alter the variable or field in SourceExpression).

  • MortenSteengaardMortenSteengaard Member Posts: 136
    Thank you - both of you!

    If I write "round("Sales Line Archive"."Unit Cost (LCY)", 0.01)" in my SourceExpr, all lines are shown with two digits, just as I want. So the problem is solved!

    But I still don't understand why NAV completely ignores what I enter in DecimalPlaces. I set my SourceExpr to ""Sales Line Archive"."Unit Cost (LCY)" and if my DecimalPlaces for example is set to "0:0", or "2:2" or "3:3" the result is always the same like this:

    1.2345678
    0.00
    5.50
    1234.567

    I want that to be shown as:

    1.23
    0.00
    5.50
    1234.57

    I am very new to NAV, so there is a lot of properties that I don't know what mean.
Sign In or Register to comment.