Print Page | Close Window

Chart Filtering

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=1725
Printed Date: 02 May 2024 at 6:29pm


Topic: Chart Filtering
Posted By: AnthonyJ
Subject: Chart Filtering
Date Posted: 20 Nov 2007 at 11:48am
Hi,
 
I am new to CR. I would like to filter records within a chart. Currently, there are 4 distinct data types in my chart. I am creating 4 charts each with its own data type. Can I create a filter on charts similar to WebI ?
 
Thanks.


-------------
XIR2 on Unix Solaris
CRXIR2, Oracle 9i/10g



Replies:
Posted By: Lugh
Date Posted: 21 Nov 2007 at 5:23am
The short is answer is no, you can't filter charts.

The longer answer is yes, you can filter charts.  But, it requires thinking about the entire solution a little differently.

Let's suppose you have four data types, typeA, typeB, typeC, and typeD.  Now, your report includes all four types, so you don't want to filter the report as a whole with Select criteria.  And, you've grouped the data based on some other field, so you can't just plop the reports in the group header.  How do you create a chart just for typeA?

Create a formula, like so:

If {MyDataType} = "typeA" Then 1 Else 0

Now, if you want a count of the records that are "typeA", you just sum up this formula, instead of doing a count.

Ah, but suppose you want to total up some other value for your "typeA" records.  Well, it's the same process:

If {MyDataType} = "typeA" Then {MyOtherValue} Else 0

I have used this method to do some fairly sophisticated data shaping for my charts (I produce metrics charts in Crystal as my job).  One interesting caveat, though, is that it does produce a lot of zero values.  These are often easy to filter out if you are using Top N or specified sort charts.  They are pretty much always going to fall into that "Other" category.  And, of course, a zero value is generally invisible on a chart.  But, it can have some unexpected data points show up in your legend.




Posted By: AnthonyJ
Date Posted: 25 Nov 2007 at 3:00pm
Originally posted by Lugh

a zero value is generally invisible on a chart.  But, it can have some unexpected data points show up in your legend.
 
Thanks for responding to my question. I was able to filter the charts for each data type based on your logic. However, as you said, there are zero data points that show up in the chart. Is there a way to remove the zeroes or maybe change it's color to look invisible ?


-------------
XIR2 on Unix Solaris
CRXIR2, Oracle 9i/10g


Posted By: Lugh
Date Posted: 26 Nov 2007 at 9:43am
Generally speaking, no.  You can't really do conditional formatting inside a chart.

I'm assuming you looked at the Top N and "specified order" options?

What kind of chart are you using?





Print Page | Close Window