0
votes

Rounding of static value is different from rounding DB field value in SAP B1 crystal report 2011

I have 609,437.50 from Database when I go to Field Format and then round field I get 609,437

I have 609,437.50 in formula as static value when I round I get 609,438 which is correct same as excel

With decimal number picture

Without decimal number

How can I round Database field and get value like 609,438 while I have 609,437.50?

Please anyone can help me

1
Are in field format rounding and decimal set at same value?Arvo
Yes, are same valueSchadro
Then you likely have database value actually different from xxx.50. What data type is your value in database - some float or decimal or money? If float, then you have to convert it to decimal first - float values are inexact and rounding may behave strangely. If decimal or money, then you may have more decimal places filled (like xxx.499), which rounds down again.Arvo
Thank you so much, it's solvedSchadro
So post this as solution, please, so others can make use of it.Suncatcher

1 Answers

0
votes

You likely have database value different from xxx.50.

What data type is your value in database - some float or decimal or money?

If float, then you have to convert it to decimal first - float values are inexact and rounding may behave strangely.

If decimal or money, then you may have more decimal places filled (like xxx.499), which rounds down again. You need either accept your results or round to two decimals first; this can be visually better, but is wrong mathematically.