Solved

How can I ignore 0 values from Crystal Report .

Posted on 2004-03-28
7
1,529 Views
Last Modified: 2006-11-17
Hi ,

I have a database in MSAccess 2000 and VB programme .
And Also I have created Summary report using Crystal Report 8.5

There I have 3 values .

Ex . A1 = 50 , A2 = 0 A3 = 25
     
Using this I want to get Max of A = 50 and Min of A = 25 and Avg of A = 37.5 to take this values I want to ignore A2 = 0 .

Please help me to ignore 0 values from crystal report . But 3 records should be there .

I am Not Mean "<>" symbal . If I use this I can't take Total records are as 3 .
0
Comment
Question by:PChandima
7 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 168 total points
ID: 10701890
Hello PChandima,

You will have to create your own formula fields to calculate the statistics.

MySum:(in detail line)

Global numbervar vSum;
Global numbervar vCount;
if A<>0 then
(vSum := vsum + A
vcount := vcCount +1
)

Then where you want the average:

MyAvg:
Evaluateafter(Mysum);
Global numbervar vSum;
Global numbervar vCount;
If vCount <>0 then
vsum/vcount
else
0

Minimum also needs to use a formula:

MyMin: (in detail line)
numbervar vMin;
if A<>0 and A<vMin then
    vMin := A
else
    vMin:= vMin;
vMin

Pete
0
 

Author Comment

by:PChandima
ID: 10702262
Where should I Declare this vSum , vCount variables . I tried this in formula section . But It gave me froblem saying "The ) is missing" . After Declaring This variables How can I Call MyAvg and MyMin .

Please Help Me .

Thanks

Chandima.
0
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 166 total points
ID: 10704285
Variables are declared in formulas.

Create a formula
Open the report
Display the field tab or Click INSERT --> FORMULA
Right click on FORMULA
Select NEW
Name - RptDecls
global numbervar  vMin:= 0;
global numbervar  MyAvg := 0;
global numbervar  vMax:= 0;

Save the formula

Formulas are "called" by inserting them just as you do a database into the report.
Put RptDecls in the Report Header

Create the other formulas the same way and put them in the detail section.

mlmcc

0
 

Author Comment

by:PChandima
ID: 10712117
No I want to Add these summeries , Average , Minimum and Maximum values to one group header . I want to show these values only . And also I want to hide details section . All the report details I have added to the group header section .

Please Help me .
0
 
LVL 4

Assisted Solution

by:kssaran
kssaran earned 166 total points
ID: 10738546
For Simple Ease of use. You can create one Formula Column and assign the value as either one or Zero depends on the value of A2

it is like goto
INSERT --> FORMULA
Right click on FORMULA
Select NEW
Name - intAvgCount
include the following condition

IF (A2=0) THEN
0
ELSE
1

Drag & Drop this formula Column in the details area make it as hidden.

At the Group Summary level Take the Sum of this Formula Column You will get the count for those which A2 is not Zero then you can sumup the value of A2 and Divide by this Value to get the average

I hope you got it right this time

Happy Coding
:)


0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

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…
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