cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal reports 2008, trouble with summary from subreport

Former Member
0 Kudos

I am afraid I am no professional when it comes to using Crystal Reports, I am learning but am being asked to manipulate an existing report.  I have more familiarity with it that any body else, they bought me some text books etc...  I am at a road block however.

The report I am working with at first is straight forward, but now I need to break up data it pulls into some more groups.  We deal with eggs, so this freight and revenue report shows a total per driver per load number for whatever date range inputted.  Now I need to break it up to show inbound and outbound in addition to what it currently shows.

I tried several things but I discovered I needed to start using subreports to get what I am looking for.  I got that much to work properly, finally.  However I am trying to get a grand total to show alongside the existing grand total.

So the layout is as follows,

RH

PH

GH #1 - (hidden) Group#1 Name - delivery date field

GH#2  - Group #2 Name - drivername field

D - the details here are showing the data we want to see - naturally

GF#2a - this group shows the per driver sub totals

GF#2b - (I added this line and subreport) Subreport IN - also shows per group subtotals

GF#2c - (I added this and subreport) Subreport OUT - also shows per group subtotals

GF#1 - (hidden)

RF - Summary grand totals are here form original report, I want to in addition add summary grand totals from the sub reports.

PF

So far all is working great until I want to pull summaries from the subreport.  I read about shared variables, but I am really struggling here.  Whatever I have tried so far with shared variables only shows the same totals I get from the sub totals sections.  How do I got about making it know how to keep track of each group it has dumped information into so I can tally it up in the footer?

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Jeff,

Here's what you need to do:

1) Open/Edit Subreport 'IN' and create a formula with this code:

WhilePrintingRecords;

shared numbervar gtotal;

gtotal := <Existing Summary field>;

2) Drag and drop this formula on the Report Footer of the Subreport

3) Back in the Main report, create a new GF2 section so that you now have GF2a, 2b, 2c and 2d.

4) Move the 'Out' subreport to GF2d

5) Create a formula with this code and place this on the GF2c:

WhilePrintingRecords;

shared numbervar gtotal;

numbervar grand1 := grand1 + gtotal;


6) Create another formula with this code and place this on GH2:


WhilePrintingRecords;

shared numbervar gtotal := 0;


7) Create one last formula with this code and place this on the Report Footer - this is the grand total for IN:


WhilePrintingRecords;

numbervar grand1;


7) Repeat steps 1 through 7 for Subreport 'Out' however, make sure you change all variable names.


Let me know how this goes.


-Abhilash


Former Member
0 Kudos

Hey that's working!  I knew I came to the right place.  Thank you very much Abhilash.

abhilash_kumar
Active Contributor
0 Kudos

Glad it works! Please close this thread.

-Abhilash

Answers (0)