AX – D365FO – Round up or Round down a number to the next whole number

To round number in AX, we can use 2 method. If we wanna round up, we can use RoundUp(real value, real unit) function and we can use RoundDown(real value, real unit) function if we wanna round down numbers. For example, we can see the source code of a job below :

static void Rounding(Args _args)
{
    real    temp, roundingUp, roundingDown;
    ;
    temp = 3000 / 7;
    roundingUp = roundUp(temp, 1);
    roundingDown = roundDown(temp, 1);
    info(strFmt(“Origin : %1 RoundingUp : %2 RoundingDown : %3”, temp, RoundingUp, roundingDown));
}

The result is like a picture below :

Leave a comment