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 bkrike 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 working 1

Status
Not open for further replies.

jonbarr

MIS
Jun 20, 2003
66
NZ
Using CR v 8.0 and ODBC with SQL server

I need to create a report to show a summary of production costs for different processes.
Different processes use the same components, so it is necessary to identify which Assemblies relate to which process, and then total the components by type for each process.
I would like to finish up with a layout such as:

Process A Chemical Costs Packaging Costs Overhead Costs

Process B Chemical Costs Packaging Costs Overhead Costs

I have created a subreport to show a total of the Detail costs in the footer. Details have been hidden. When I run the subreport, it looks great, showing the total just as I want it.
The main report is linked by Assembly number, and is used to identify the different Processes. I have grouped by Assembly number, and inserted the subreport in the group footer. Using a date parameter, the Main report shows every assembly for the selected process, with total costs as required displayed in the subreport for each Assembly.

Now the problem is to show a Total for each of the cost centres.
I have tried using variables in subreport and Main Report footer, but only the last Assembly value is displayed, rather than the total required.
Formulas used were
Sub report
//Total Overhead Costs
WhilePrintingRecords;
Shared NumberVar OverheadTotal := Sum ({@Overhead Total Cost})

Main report
//Total Overhead Costs
WhilePrintingRecords;
Shared NumberVar OverheadTotal;
OverheadTotal

I have tried using Running totals in the variables but still get just the total of the last Assembly transaction showing in the Main report. What am I doing wrong ??
 
You dont say where you placed the subreport - this will have everything to do with your problem.

I hope this helps

paulmarr
 
Hi Paul
Thanks for your reply.

What part of >>>I have grouped by Assembly number, and inserted the subreport in the group footer.<<< do you not understand ??
 
jonbarr,

For somebody requesting help - thats not a very tactful response.

If you are trying to show totals for cost centres - then shouldn't that be the group you place the subreport in?

How about spelling out your groups - how many do you have and in what order?

paulmarr
 
You have to accumulate the shared variable in the main report. Create a formula:

//{@accum} to be placed in a group footer_b section (insert a section below the one in which you have placed the subreport):

whileprintingrecords;
shared numbervar OverheadTotal;
numbervar sumOH := sumOH + OverheadTotal;

//{@display} to be placed in the report footer:
whileprintingrecords;
numbervar sumOH

-LB
 
Sorry if my reply sounded untactful Paulmarr, even tho I thanked you for your response. Perhaps the effect of a very long and frustrating day I had here. My apologies.

lbass - I thank you very sincerely for your reply - it worked beautifully - and so easy too. I can see I still have a lot to learn about variables and subreports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top