Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Counting rounded numbers Post Reply Post New Topic
Author Message
KevV
Senior Member
Senior Member


Joined: 19 May 2011
Online Status: Offline
Posts: 106
Quote KevV Replybullet Topic: Counting rounded numbers
     Posted: 17 Jul 2012 at 11:04am
I have a report that groups orders by hour. In the group footer it adds a column and if the total is more than 100 it rounds it to 100. The problem I have is that I need to do a grand total in the report footer and add all of those numbers and if it rounded a number to 100 I want it to treat it as 100 and not the actual number, so using the example below I want my report to display 275 not 325 .
 
Example:
 
       Hour         actual number       reported number
 GF      8:00                 55                             55
 GF      9:00               140                           100
 GF      10:00             110                           100
 GF      11:00               20                             20
 
 RF     Grand total      325                           275
 
 
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 17 Jul 2012 at 12:13pm
The only thing I can think of is a manual running total (it assumes you have a RT at the Group level). 
Something like this in the GF.
shared numbervar GrandTotal;
if (#GroupRT) > 100 then GrandTotal := GrandTotal + round(#GroupRT,-2)
else GrandTotal := GrandTotal +#GroupRT

Then in the RF
shared numbervar GrandTotal;

I believe this will work.
IP IP Logged
KevV
Senior Member
Senior Member


Joined: 19 May 2011
Online Status: Offline
Posts: 106
Quote KevV Replybullet Posted: 17 Jul 2012 at 12:39pm
It worked if the number didnt go over the next hundred. So for example if the total of the column was 450 it would round it down to 400 and not to 100.
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 17 Jul 2012 at 12:46pm
Sorry I misunderstood.  The then part of the if would read like this.
GrandTotal := GrandTotal + 100

IP IP Logged
KevV
Senior Member
Senior Member


Joined: 19 May 2011
Online Status: Offline
Posts: 106
Quote KevV Replybullet Posted: 17 Jul 2012 at 1:18pm

That was it. I am not sure if there is something else in the formula or in my report because it starts out with a begining balance of 100. I ran it for several days and I always get the same begining. 

 
 
Thanks for the help
KevV
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