Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Problem with grand total on subreport Post Reply Post New Topic
Author Message
TAH2
Newbie
Newbie
Avatar

Joined: 16 Mar 2010
Online Status: Offline
Posts: 23
Quote TAH2 Replybullet Topic: Problem with grand total on subreport
    Posted: 16 Mar 2010 at 11:18am

I am new to Crystal Reports and I am having problems with subreports.  I have a Crystal Report XI subreport that shows Net Change by 'LC type' (ex: Leasing $10,000, IRB $200,000). I am able to link this information to my main report, however I am unable to get a grant total for the Net Change ($210,000) for all LC types on the subreport so that I can then pass that back to the main report.  The subreport provides the sum of the NetChange by LC type.  How do I get the grand total on the subreport and pass it back to the main report?

 

LC Type                Total                Net Change

Electricity            800,000            200,000

Leasing                100,000            10,000

IRB                       450,000           0

Grand Total:       1,350,000           210,000

IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 16 Mar 2010 at 11:36am
You should (and for some reason other users are having issues) be able to create a shared variable in the subreport, assign the variable the value (sum of NetChange).  Also have a formula in the main report with the same shared variable defination and display the value.
 
I hope this helps.
IP IP Logged
TAH2
Newbie
Newbie
Avatar

Joined: 16 Mar 2010
Online Status: Offline
Posts: 23
Quote TAH2 Replybullet Posted: 17 Mar 2010 at 5:04am
Thanks, but I had already tried that as well but it did not work.  Since the subreport is grouped by LC Type the variable displays the total by type instead of the grand total for all types.  Any other suggestions?
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 17 Mar 2010 at 5:41am

It appears that you would need to make a 'running total' from the value passed back from the subreport.  I have tested the following code, so it may not work.

 
In the header of the report put a formula something like this.
shared numbervar Net_change_total :=0;
 
In a section following the subreport put a formula something like this.
shared numbervar Net_change;
shared numbervar Net_change_total;
Net_change_total := Net_change_total + Net_change;
 
In a section where you want the total to appear.
shared numbervar Net_change_total;
Net_change_total;
 
Of course the important formula in the subreport.
shared numbervar Net_change := (running total value);
 
I hope this works.
IP IP Logged
TAH2
Newbie
Newbie
Avatar

Joined: 16 Mar 2010
Online Status: Offline
Posts: 23
Quote TAH2 Replybullet Posted: 17 Mar 2010 at 7:25am
That worked.  Thanks.
IP IP Logged
remymaq
Newbie
Newbie
Avatar

Joined: 12 Dec 2014
Location: United States
Online Status: Offline
Posts: 2
Quote remymaq Replybullet Posted: 13 May 2015 at 7:40am
What does the Net_Change variable represent?
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.047 seconds.