Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: sum of subreport Post Reply Post New Topic
Author Message
bluelake
Newbie
Newbie
Avatar

Joined: 08 Jul 2010
Online Status: Offline
Posts: 24
Quote bluelake Replybullet Topic: sum of subreport
     Posted: 12 Apr 2012 at 9:48am
My report uses two tables:  table A which shows client demographic information and table B which shows client payment information.  The tables are linked by the client ID.  My main report is grouped by 1)client's geographic location from table A ; and 2) client name from table B.  I have a subreport that sums each client's payments which I placed in the Group 2 footer. How can I now sum payments of all clients by geographic location?  There are several parameters in both the main and subreport.  I've tried passing a shared variable from the subreport to the main report, but it won't let me sum it.  Thanks in advance for your help.
IP IP Logged
bluelake
Newbie
Newbie
Avatar

Joined: 08 Jul 2010
Online Status: Offline
Posts: 24
Quote bluelake Replybullet Posted: 20 Apr 2012 at 4:43am
I found the solution on another forum. 
  1. I used a shared variable to pass the amount paid from the subreport to the main report.
  2. Placed this formula in the higher group header:  EvaluateAfter ({@shared});
    numbervar sumx;
    not inrepeatedgroupheader ;
    sumx:=0;
  3. Placed this formula in the same group footer as the shared variable: whileprintingrecords;
    shared numbervar subtotal;
    numbervar sumx := sumx + subtotal;
    numbervar gtx := gtx + subtotal;
  4. Placed this formula in the higher group footer: whileprintingrecords;
    numbervar sumx;
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