Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Return final running total in group footer Post Reply Post New Topic
Author Message
louisville2k10
Groupie
Groupie
Avatar

Joined: 13 Sep 2010
Location: United States
Online Status: Offline
Posts: 45
Quote louisville2k10 Replybullet Topic: Return final running total in group footer
     Posted: 16 Feb 2011 at 3:42am
Hi, I need to return the report's final running total field in a group footer.
 
For instance, I have this:
 
User           Amount       Running Total   
Person A     500            500         
Person B     500            1000
Person C     500            1500
 
I want this:
User          Amount       Total
Person A    500             1500
Person B    500             1500
Person C    500             1500
 
My data is grouped by User. Please submit ANY possible solutions...I need to turn this report around asap.
Thanks for your help!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Feb 2011 at 3:47am

if you can get the total in your source data (e.g. a view or stored proc) then you can display it using that, otherwise I think your only option would be to get it from a sub report and pass it back into the main report as a shared variable.

IP IP Logged
louisville2k10
Groupie
Groupie
Avatar

Joined: 13 Sep 2010
Location: United States
Online Status: Offline
Posts: 45
Quote louisville2k10 Replybullet Posted: 16 Feb 2011 at 4:00am
I think the subreport option is my only realistic one. How do I pass it along as a shared variable? Do shared variables allow me to reference the field in a formula in the Parent report? I need to be able to do this so I can do a calculation on it.
Thanks for your help!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Feb 2011 at 4:13am
Do you really need it displayed or do you just need it for calculations?
If only for calculations is it really a running total or can the same value be garnered from a summary function? If so you could avoid the subreport.
 
The sub report has to run before the location you want to dispaly it. Sicne you only want to run it once and get one number frmo it that can be used through out the main report I would stick it in report header A. You cannot suppress a subreport and still have it run so you have to suppress all fields in the subreport and then suppress the reportheaderA when blank.
In the main report create your shared variable formula field.
in the sub report create the same variable assigning the value to it there.
the shared variable value in the main report can be used in formulatic calcualtions.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Feb 2011 at 4:16am
actually, now that i think on it more, if the value can be garnered using any insert summary function you could display it anywhere in the main report without the sub-report.
IP IP Logged
louisville2k10
Groupie
Groupie
Avatar

Joined: 13 Sep 2010
Location: United States
Online Status: Offline
Posts: 45
Quote louisville2k10 Replybullet Posted: 16 Feb 2011 at 5:46am
Well unfortunately, I cannot use the insert summary function because when I do, the final number it gives me is incorrect. The final number that the running total field gives me is correct if I sum on the change of username. If I could resolve that problem, then I would most definitely use the summary function - it seems to be the easiest.
 
I believe that it isn't working properly because my full blown report looks like this (see below). Because there are multiple records of the averageB field for each single record for the AmountA field for a given person. My grand total is about 5X as large as it should be.
 
Group 1
Username      AmountA    AverageB
Person A           500               50
Details                             60
                                       40
                                       55
                                       45
Person B           500               60
                                       70
                                       40
                                       70
                                       60
                  
Thanks for your help!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Feb 2011 at 6:17am
looks like the sub -report might have to be the solution
IP IP Logged
louisville2k10
Groupie
Groupie
Avatar

Joined: 13 Sep 2010
Location: United States
Online Status: Offline
Posts: 45
Quote louisville2k10 Replybullet Posted: 17 Feb 2011 at 2:39am
The subreport is now showing me the numbers I want to see, but I need to do a calculation that involves a field found in the subreport and a field found in the Parent report. Can you help me achieve this?
 
When I go to the Parent report, the subreport formula that I am using to calculate the subreport field (the one I want to use in the calculation - a final running total amount placed in the subreport's group footer) is not visible.
 
Here are pictures of what I'm working with:
Uploaded with ImageShack.us
 
I'm trying to divide the total user manned time (1292.29 in this example) by the individual manned time (46.5) to get me a percentage user manned time of the whole department's manned time.
 
What a doozy this one is!
Thanks for your help!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Feb 2011 at 4:28am
did you create the same shared variable field in the main report?
name = mainreport_x
shared numbervar x;
x:=x
 
now you can use this formula field in your calculations
#totalmantimed / @mainreport_x
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Feb 2011 at 4:29am
note that the @mainreport_x formual field can only be used in any section below where the subreport is placed.

Edited by DBlank - 17 Feb 2011 at 4:29am
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