Round off amount

suraj92291suraj92291 Member Posts: 49
edited 2015-02-23 in NAV Three Tier
Hello Experts,

Nav 2013R2 have function for rounding up amount or other decimal values in reports.So it will directly rounding up and display the amount.but i need to display round off amount which will add or subtract from the actual amount (please find attachment for same ).

any help will be greatly appreciated.

Thanks & Regards,

Suraj
“Any fool can know. The point is to understand.”
― Albert Einstein

Answers

  • vremeni4vremeni4 Member Posts: 323
    Hi,

    From NAV help
    Rounds the value of a numeric variable.


    NewNumber := ROUND(Number [, Precision] [, Direction])



    Parameters
    Number
    Type: Decimal

    The number that you want to round.

    Precision
    Type: Decimal

    This optional parameter determines the precision used when rounding. If you do not specify a Precision parameter, then the following steps are used to specify the precision:

    The function ReadRounding in Codeunit 1, Application Management, is called. ReadRounding returns a decimal value that is the precision. By default, the ReadRounding function returns the Amount Rounding Precision field from the GLSetup table.

    If you have customized Codeunit 1 and it does not implement the ReadRounding function, then the No. of digits after decimal in the Regional and Language Options on the current computer is used to specify the precision. If the No. of digits after decimal does not specify a valid value, then the precision is specified as 2 digits after the decimal.

    Direction
    Type: Text or Code

    This optional parameter specifies how to round the Number parameter. The default rounding method is '='. The following are the options for rounding:

    '=' rounds up or down to the nearest value (default). Values of 5 or greater are rounded up. Values less than 5 are rounded down.

    '>' rounds up

    '<' rounds down
    DecimalToRound := 1234.56789;
    Direction := '>';
    Precision := 0.001;
    Result := ROUND(DecimalToRound, Precision, Direction);
    MESSAGE(Text000, Format(DecimalToRound,0,1), Precision, Direction, Result);
    

    I hope this helps.
    Thanks.
  • clauslclausl Member Posts: 455
    edited 2015-02-23
    Maybe me, but can you not just do the following in Visual Studio:

    Round(Fields!Amount.value)-Fields!Amount.value= You round amount.

    /Claus Lundstrøm
    Claus Lundstrøm | MVP | Senior Product Manager | Continia.com
    I'm blogging here:http://mibuso.com/blogs/clausl and used to blog here: http://blogs.msdn.com/nav
    I'm also offering RDLC Report Training, ping me if you are interested. Thanks to the 700 NAV developers that have now already been at my training. You know you can always call if you have any RDLC report issues :-)
  • suraj92291suraj92291 Member Posts: 49
    Thanks vremeni4 & clausl for the reply!

    @clausl
    Thanks sir,
    It worked :thumbsup:

    Regards,
    Suraj
    “Any fool can know. The point is to understand.”
    ― Albert Einstein
Sign In or Register to comment.