Tuesday, November 26, 2019

Round() function in X++

class RoundUpto2decimalPoints
{
    public static void main(Args _args)
    {
    
        real cost = 0.057139;
          
        info(strFmt('%1',round(cost,0.01)));
      
    }
}

In the round function if you want to round up to 2 decimal places then put 0.01. Similarly for rounding up to 3 decimal places we will put 0.001 in the round function.

Thanks,
Uma

No comments:

Post a Comment

using SQL Query in X++

 If you need to execute sql query inside your X++ code then below example can help you. To pass value to SQL query we need to use strfmt() f...