Solved

Running Totals of Sub Reports

Posted on 2009-04-03
15
341 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
  • 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
 
LVL 100

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 100

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 100

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 100

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 100

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 100

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Conditional Text in Crystal 4 44
Crystal Reports Subreport details 16 52
Crystal Reports last day of month 2 44
Crystal reports vb.net 2 16
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now