Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2012-03-14
5
Medium Priority
?
284 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 2000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

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. …
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

618 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