Solved

Subreport in Crystal passing data and need to build an average in Main Report

Posted on 2012-03-14
5
282 Views
Last Modified: 2012-03-14
Subreport formula:

 if({CallDetail.InternalNum})  > 600 and ({CallDetail.InternalNum}) <=700 then
0 else {CallDetail.Duration}

I've added the subreport in the DETAILS section on my MAIN REPORT

I need to now calculate an average for everything that was passed in my REPORT FOOTER

Is this possible?  If so, could someone provide complete details on how to do this?

Thanks in advance..
0
Comment
Question by:wshcraft70
[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
  • 3
  • 2
5 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 500 total points
ID: 37722503
In the report header add a formula
WhilePrintingRecords;
Shared NumberVar RecCount;
Shared NumberVar DurationTotal;
""

IN the subreport modify your formula

WhilePrintingRecords;
Shared NumberVar RecCount;
Shared NumberVar DurationTotal;
Local NumberVar CallDuration;

if({CallDetail.InternalNum})  > 600 and ({CallDetail.InternalNum}) <=700 then
     CallDuration := 0
else
    CallDuration := {CallDetail.Duration};
RecCount := RecCount + 1;
DurationTotal := DurationTotal + CallDuration;
CallDuration

In the report footer
WhilePrintingRecords;
Shared NumberVar RecCount;
Shared NumberVar DurationTotal;
If RecCount = 0 then
    0
Else
    DurationTotal / RecCount

mlmcc
0
 
LVL 1

Author Comment

by:wshcraft70
ID: 37722560
I've got this on a group and I need the record count to be reset for my average per group record..

Where would I add this?

Visuals are awesome..  ;)

Thank you soooooo much..
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 37722609
Put the display/avverage calculation formula in the group footer

In the group header add this formula to reset the values
WhilePrintingRecords;
Shared NumberVar RecCount;
Shared NumberVar DurationTotal;
RecCount := 0;
DurationTotal := 0;
""
0
 
LVL 1

Author Comment

by:wshcraft70
ID: 37722634
I cannot get the average Talk Time to calculate..  For some reason, the group rec count doesn't seems to be resetting..  Below is what I have..  Do you see where I've gone wrong?

Currently:

Report Header:

WhilePrintingRecords;
Shared NumberVar RecCount;
Shared NumberVar DurationTotal;
RecCount := 0;
DurationTotal := 0;

Sub Report:

whileprintingrecords;
shared numbervar RecCount;
shared numbervar DurationTotal;
Local NumberVar CallDuration;

if({CallDetail.InternalNum})  >= 600 and ({CallDetail.InternalNum}) <700 then
     CallDuration := {CallDetail.Duration}
else
    CallDuration := 0;
if CallDuration > 0 then
  RecCount := RecCount + 1;
DurationTotal := DurationTotal + CallDuration;
CallDuration


Group Footer:


WhilePrintingRecords;
Shared NumberVar RecCount;
Shared NumberVar DurationTotal;

If RecCount = 0 then
    0
Else
   DurationTotal / RecCount;
0
 
LVL 1

Author Comment

by:wshcraft70
ID: 37722700
I dropped the Report Header down to the Group Header and I'm now GOOD TO GO..  :D

Thanks for everything..
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

726 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