Solved

Running Totals of Sub Reports

Posted on 2009-04-03
15
347 Views
Last Modified: 2012-05-06
I have a main report with 2 Sub Reports.   Both Sub reports have a Running Total "SUM" of a column called "Unit Price"  

Is there ANY way on the MAIN report, to have a Total "SUM" of both Running Totals from teh Sub reports?
0
Comment
Question by:chrisryhal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
  • 2
15 Comments
 
LVL 17

Expert Comment

by:MIKE
ID: 24061639
Yes..you need to create a formula that contains a VARIABLE to catch or HOLD the summaries from the Subs.

I think you can use the Running Subtotal if you choose it from the DataFields.

Formula IN the SUB will look like this:

//@SubSum1
whileprintingrecords;
global numbervar SUB1SUM:= [Your Running Sub-total field here]  <====choose from field choices

Keep in mind GROUPING requirements...choose the GROUP instance of the subtotal.

Formula for the Main Report will look something like this:

//@MainSubSum1Display
whileprintingrecords;
global numbervar SUM1SUM;
0
 
LVL 2

Author Comment

by:chrisryhal
ID: 24061912
//@MainSubSum1Display
whileprintingrecords;
global numbervar SUM1SUM;

                    appears not be 0.  

//@SubSum1
whileprintingrecords;
global numbervar SUB1SUM:= {#RTotal0}

                    Works great on the SUB report
0
 
LVL 17

Expert Comment

by:MIKE
ID: 24061940
Ok..so tell me more about the subs...so how are they linked to the main....are the subs based on GROUPING of the main?

IF you have screenshots of main showing where subs come into play..it would be great...
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 101

Expert Comment

by:mlmcc
ID: 24062350
You need to use SHARED rather than global.

Global variables only work on a report.
Shared allows the data to pass between the main and subreports.

In the main report header add a formula

whileprintingrecords;
Shared numbervar SUM1SUM;
Shared numbervar SUM2SUM;

Where you want to use it in the main report.  It must be after the subreport

whileprintingrecords;
Shared numbervar SUM1SUM;
Shared numbervar SUM2SUM;
SUM1SUM + SUM2SUM
In the subreport

//@SubSum1
whileprintingrecords;
Shared numbervar SUB1SUM:= {#RTotal0}

//@SubSum2
whileprintingrecords;
Shared numbervar SUB2SUM:= {#RTotal0}

mlmcc
0
 
LVL 2

Author Comment

by:chrisryhal
ID: 24062697
mlmcc,

Added the @SubSum's on the sub reports like so:

     //@SubSum1
     whileprintingrecords;
     Shared numbervar SUB1SUM:= {#RTotal0}

The value DOES show on the sub reports.

Added the:
     whileprintingrecords;
     Shared numbervar SUM1SUM;
     Shared numbervar SUM2SUM;

In the main report header.  Then RIGHT AFTER both Sub Reports, I added as you instructed:

     whileprintingrecords;
     Shared numbervar SUM1SUM;
     Shared numbervar SUM2SUM;
     SUM1SUM + SUM2SUM

Value displaying on the main report is "0.00"
0
 
LVL 2

Author Comment

by:chrisryhal
ID: 24062770
Here, I zipped it up if that helps.  Change the file extension to .RPT cause EE won't accept it.

I placed RED textbox on where I did what was instructed to do.
CCI.txt
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 24062950
To use the values the formula in the main report must be after the subreport

The formula for the report header is simply to declare the variables for the main report
     whileprintingrecords;
     Shared numbervar SUM1SUM;
     Shared numbervar SUM2SUM;

In a later section after the subreports add the other formula     whileprintingrecords;
     Shared numbervar SUM1SUM;
     Shared numbervar SUM2SUM;
     SUM1SUM + SUM2SUM

mlmcc
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 24062985
Do the correct values appear in the subreports?

The value in the mainreport page header will be 0

mlmcc
0
 
LVL 2

Author Comment

by:chrisryhal
ID: 24063857
Yes they appear correctly in the sub reports
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 24064455
In the main report you have

whileprintingrecords;
Shared numbervar SUM1SUM;
Shared numbervar SUM2SUM;

In the subreports you use

whileprintingrecords;
Shared numbervar SUB1SUM;

whileprintingrecords;
Shared numbervar SUB2SUM;

They have to have the same names throughout.  Change the main report to
Report header
whileprintingrecords;
Shared numbervar SUB1SUM;
Shared numbervar SUB2SUM;

ReportFooter
whileprintingrecords;
Shared numbervar SUB1SUM;
Shared numbervar SUB2SUM;
SUB1SUM + SUB2SUM

mlmcc

0
 
LVL 2

Author Comment

by:chrisryhal
ID: 24150488
still didn't work
0
 
LVL 2

Author Comment

by:chrisryhal
ID: 24150747
Actually I did get it working.  Problem is that the value needs to go ABOVE the Sub Reports????
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 24151671
Can't be done since that part is printed before the subreports are run.

Actually you could by having the subreport in twice.
One that just gets the values you need
The other that displays later

mlmcc
0
 
LVL 2

Author Comment

by:chrisryhal
ID: 24151938
mlmcc,

Thats true, I could just have it in there, but surpressed if you agre?  Good idea, will try that.  

Appreciate the help!!
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 500 total points
ID: 24152175
Don't suppress it since it won't run then.
You have too do the suppression in the subreport so it doesn't display anything then you can suppress the blank section through the SECTION EXPERT

mlmcc
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question