Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subreport Totals not displaying properly on Main Report

Status
Not open for further replies.
Apr 23, 2003
5
0
0
US
Crystal Reports 9.0, SQL Database, ODBC Connection

I have one subreport and one main report. Sum Provider and Sum Dept listed below are both groups on the report. I created formulas for the totals on each the Prov and Dept group and columns.

Main Report Info Subreport Info

AM PM Arrived Booked
Sum Prov 1 10 5 10 15
Sum Prov 2 20 20 30 40
Sum Prov 3 6 4 5 10

Expected results
Sum Dept 36 29 45 65

Actual results
Sum Dept 36 29 5 10

Sum Prov subreport information displays properly on my main report. I need the Sum Dept information to also display on the main report, but my subreport only displays the last record in the group Sum Provider

I have tried to use a shared variable, but it is not working properly

\\Subreport
whileprintingrecords;
shared numbervar BookedNewsumdept:=Sum({@BookedNew});

\\Main Report
whileprintingrecords;
shared numbervar BookedNewsumdept;
numbervar sumBookedNew := sumBookedNew + BookedNewsumdept;

Is there a better way of doing this?

-Eighties
 
So the Prov group is nested within the Dept group? You should insert a second group section for the Prov group (we'll assume your display is in the GF#2a footer and that the subreports are located there). So your accumulation formula should be in the GF#2b footer (you can suppress this section).

Then you need a display formula for the Dept footer:

whileprintingrecords;
numbervar sumBookedNew;

And a reset formula for the Dept group header:
whileprintingrecords;
numbervar sumBookedNew := 0;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top