Tips and Tricks
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Tips and Tricks
Message Icon Topic: Shared Variables Post Reply Post New Topic
Author Message
BlakeJ
Newbie
Newbie
Avatar

Joined: 27 Aug 2007
Location: United States
Online Status: Offline
Posts: 11
Quote BlakeJ Replybullet Topic: Shared Variables
    Posted: 14 Mar 2008 at 8:40am
I have a main report using a subreport.  In the subreport I have a shared variable that counts the number of times an item appears.  I am able to bring the shared variable over to the main report so that each subreport shows its own total, for example 0, 1, 3, 1, etc.  The problem I'm having is I can't seem to find a way to have the main report sum these values for an overall total at the bottom of the main report. I get an error that says I cannot sum the shared variable.  I haven't run across a solution to this in any of the forums yet.
Blake
IP IP Logged
SpruceGoose
Newbie
Newbie
Avatar

Joined: 24 Apr 2008
Online Status: Offline
Posts: 1
Quote SpruceGoose Replybullet Posted: 24 Apr 2008 at 7:07pm
I'm not sure I understand exactly what you're after, but I'll take my best stab at it.  When you want to get a summary of shared variables from a subreport that have been output to a group footer in the main report, you can use the following method.  Create the following 2 formula fields and enter the formulas below.

Total Shared Variables

WhilePrintingRecords;
Shared numberVar tsv;
tsv := tsv + {your shared variable}


Grand Total Shared Variables

WhilePrintingRecords;
Shared numberVar tsv;
tsv


You'll want to change the variable declarations depending on your data type.  Insert a section below Group footer #1a, and put the Total Shared Variables formula field in that new section, you can suppress this, as it's just a running total.  Then place the Grand Total Shared Variables formula field in the report footer.  Preview the report and you'll have a grand total of your shared variables. 

I hope that helps. 




Edited by SpruceGoose - 24 Apr 2008 at 7:33pm
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.031 seconds.