AX / D365FO – Rounding in AX (real to integer)

How to perform a successful round in AX from real to integer?…
Well, the answer is: use the function decround.

static void Job1(Args _args)
{
    int i, ii;
    real r = 334.55, r2 = 334.14;
    ;

    i = decround(r, 0);
    ii = decround(r2, 0);

    // It shows 335, 334
    info(strfmt("%1, %2", i, ii));
}

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