Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Tricky Sums Post Reply Post New Topic
Author Message
yggdrasil
Senior Member
Senior Member
Avatar

Joined: 19 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 150
Quote yggdrasil Replybullet Topic: Tricky Sums
    Posted: 07 Aug 2007 at 4:17am
I have a report with 2 groups. In the group footer of the inner group I have several shared variables that conditionally sum up from the detail lines. 
 eg
{@sumA} is 1 if a detail field is A and 0 if it isn't, (there are similar formulae for other types), and the summary formula is:-
 
WhilePrintingRecords;
shared numbervar senAcount;
if {@sumA} > 0 then
senAcount := senAcount + 1
else senAcount
 
That all works fine in GF1. But then I have to show it in GF2, and at this point it adds the last @sumA on again, making the totals one out. 
How can I take the figures in GF1 and put them unaltered in the fancy design bit of the report in GF2, which does an awful lot of other things as well, and is what I am being asked to produce.
 
Please don't suggest a subreport, I am already using one to get the details, and they can't be nested, which is why I am doing all this explicitly.
 
 
IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet Posted: 07 Aug 2007 at 8:05am

You should make certain that the formula in the group footer simply returns the variable and does no further calculations.

It might look like this:

---------------------------
WhilePrintingRecords;
shared numbervar senAcount;
senAcount;
-----------------------------
 
Hope this helps
 
Regards,
 
John W.
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: 08 Aug 2007 at 12:17am
I had tried that. It didn't work. It still adds the extra one in again.
IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet Posted: 08 Aug 2007 at 3:49pm

I would recommend that you take another look your report design.  Somewhere you are having one additional pass. It is quite likely in your Groups and how the report iterates through them. When I have run into the problem this where I usually find the solution.

Kind of hard to help much more without the layout.   
 
Typcially I see in my reports a layout like
 
Group1Header 
Group2Header
Details
Group2Footer
Group1
 
If you are able what happens if you run the calcs inside of Group 2?
 
Perhaps Dell or Brian have a better recommendation.
 
Regards,
 
John W.
 
 
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 08 Aug 2007 at 4:30pm
Instead of using your second formula, create a "Summary" field to sum the first formula at each group level where you want it.
 
To get to the Summary wizard, go to the Insert menu and select Summary or click on the button with a sigma (angular capital E) on it.
 
-Dell
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: 09 Aug 2007 at 3:19am
Thanks for all your help. I have gone all through it again, and got a workround. It was ok within the inner group GF2, and I was resetting all the sums to zero for each outer group GF1. So now I have added the reset formula in again  in a suppressed outer group footer GF1a  before showing the data in a GF1b footer.
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.