Reputation: 83
This is the sample layout of my crystal report...
expenses and amount are from subreport while the project name is in the main report.
Project Title: Expenses Amount
Name of Project1 Item1.1 0.00
Item1.2 0.00
Item1.3 0.00
Name of Project2 Item2.1 0.00
Item2.2 0.00
TOTAL: 0.00
I tried using this solution: Crystal Reports: How to pass a parameter from a subreport to the parent report? but the problem is, it only return the last group total (in this case total expenses of Name of Project2 only and expenses in Project1 is not included in the total).
Please help. Thanks! :) God bLess!
Upvotes: 0
Views: 1002
Reputation: 156
I have to agree with Ryan, lose the subreport. Use groups and running totals to give the totals that you need. The layout would be similar to this:
Report Header: <subdued>
Page Header: Project Title
Expenses Amount Group Header 1: Name of Project1
Detail: Item1.1 0.00
Detail: Item1.2 0.00
Detail: Item1.3 0.00
Group Footer: <use as space between groups or add a subtotal>
Group Header 1: Name of Project2
Detail: Item2.1 0.00
Detail: Item2.2 0.00
Group Footer: <use as space between groups or add a subtotal>
Report Footer: TOTAL: 0.00
Page Footer: Page x of y
Upvotes: 0
Reputation: 7287
You can use a global variable in the main report to store the accumulating amounts you pass back from the subreports via the shared variable.
global numbervar mainTotal;
shared numbervar subReportAmount;
mainTotal := mainTotal + subReportAmount
Really, I'd recommend doing away with the subreport altogether if you can. Doing it this way is much more complicated, prone to error, and much slower than joining all your tables in the main report or using a SQL expression.
Upvotes: 0