Solved

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

Posted on 2012-03-14
5
278 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
  • 3
  • 2
5 Comments
 
LVL 100

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 100

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

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. …
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 …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

803 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