AX 2012/ D365FnO – HOW WE CAN ROUND UP AND DOWN AMOUNT USING X++

D365fno-PostImage

How we can round up and down the amount in X++.

Rounding up and down is necessary in financial calculations to ensure accuracy, consistency, and compliance with regulatory requirements. Rounding up or down helps to eliminate decimals, maintain consistency in calculations, and ensure that numbers are accurate and consistent. To round the amount in D365FnO X++, you can use the roundUp and roundDown methods. Here is an example of how to use the roundUp and roundDown methods to round a number in D365FnO X++:

class roundingAmount
{
   public static void main(Args _args)
   {
        real  myAmount, roundingUp, roundingDown;
        myAmount = 123.4567;
        roundingUp = roundUp(myAmount, 1);
        roundingDown = roundDown(myAmount, 1);
        info(strFmt("OriginAmount : %1 RoundingUp : %2 RoundingDown : %3", myAmount, roundingUp, roundingDown));
   }
}
This site uses cookies to offer you a better browsing experience. By browsing this website, you agree to our use of cookies.