Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Rounding Issue Post Reply Post New Topic
Author Message
CR9Dev
Newbie
Newbie
Avatar

Joined: 12 Mar 2008
Location: Malaysia
Online Status: Offline
Posts: 2
Quote CR9Dev Replybullet Topic: Rounding Issue
     Posted: 12 Mar 2008 at 7:10pm
Appreciate help on some rounding in CR9,
 
I'm using SQL2005 and CR9.
 
When a value such as 1.20449 is rounded to 2 decimal places in CR9 it ends up as 1.20 in the report when IT SHOULD BE 1.21 ie. the Rounding Progression (logically) should look something like this :
 
a. 1.20449 (original value)
b. 1.2045 (4 decimal places)
c. 1.205 (3 decimal places)
d. 1.21 (2 decimal places)
 
The Original Value of 1.20449 resides in a SQL2005 Table, Money type field.
 
UR help greatly appreciated.
Thkx.
IP IP Logged
yggdrasil
Senior Member
Senior Member
Avatar

Joined: 19 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 150
Quote yggdrasil Replybullet Posted: 13 Mar 2008 at 7:05am
This isn't how rounding works. It happens all in one go.
 
When you ask  for 1.20449 to be rounded to 2 decimal places, it decides if the whole number is nearer to 1.20 or 1.21, that is, less than or greater to 1.205
And it is less, so 1.20 is correct
 
IP IP Logged
CR9Dev
Newbie
Newbie
Avatar

Joined: 12 Mar 2008
Location: Malaysia
Online Status: Offline
Posts: 2
Quote CR9Dev Replybullet Posted: 13 Mar 2008 at 11:26am
Thanks, your are right in the standard method of how rounding works.
 
Is there a function / way to get that kind of "Progressive" Rounding (as illustrated) in Crystal Reports OR can a recursive rounding function be written in CR9?
 
e.g. something like this
 
    round(round(round(number2round, 2),3),4)
 
except that I do not know the exact number of decimal places for each number2round in each row as it is a result from a very complex formulae.
 
Any ideas please?
 
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 13 Mar 2008 at 12:33pm
You actually answered your own question! I entered the formula you just mentioned and it works the way you want it to.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum