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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s