Solved

# Pie Charts and Grand Totals

Posted on 2012-09-14
538 Views
I'm sure if I didn't have this huge headache, and the immense desire to leave for the weekend, I could search myself for the answer.

But posting a fresh question is much easier.

First off, I'm using Crystal Repots XI

I have a report where I need to show a pie chart wherein the sections show values representing sums from counting records based on the values of certain fields.

Let me explain...

I have a field called "Progress".  I have several formulas that return 1 to 0 based on the contents of the field.  For instance, I have a formula object called "Sales In Transit" which has the code like this:
Dim nRetVal As Number
If {MYTABLE.Progress} = "In Transit" Then
nRetVal = 1
Else
nRetVal = 0
End If
formula = nRetVal
This is repeated for a few others such as "Ordered", "In Picking", "Delivered" etc.

In the Report Footer, I have Sums of each of these, and the values are correct.  Now I want a pie chart (also in the Report Footer) that shows a segment for each of the "Progress" values.

In the Chart Expert, I tried putting the field objects in the "Show Objects" section of the Data tab (and selected For All Records), but that doesn't work.

How do I do this?

TIA
0
Question by:Clif

LVL 100

Expert Comment

Use the field MyTable.Progress as the summary for the chart and use COUNT as the summary

mlmcc
0

LVL 11

Author Comment

Ok, I get that.  There's a small problem, though.  In the original formula (shown in my OP), when the field contains "Delivered" (as well as one or two other options), it also contains a date, something like this: "Delivered - 08/20/2012".  The formula ignores the date.  So, the formula Progress_Delivered looks more like this:
Dim nRetVal As Number
If Left({MYTABLE.Progress}, 10) = "Delivered" Then
nRetVal = 1
Else
nRetVal = 0
End If
formula = nRetVal

When I setup the chart as you suggest, it sees each "Delivered" as a separate value when the dates are different.

How do you suggest I get around this so that every field that begins with "Delivered" is treated as the same no matter what text comes after the word "Delivered"?
0

LVL 100

Accepted Solution

You could use a formula like

If Left({MYTABLE.Progress}, 10) = "Delivered" then
"Delivered
Else
{MYTABLE.Progress}

ANother way would be
If {MYTABLE.Progress} STARTSWITH "Delivered" then
"Delivered
Else
{MYTABLE.Progress}

If {MYTABLE.Progress} LIKE  "Delivered*" then
"Delivered
Else
{MYTABLE.Progress}

mlmcc
0

LVL 34

Expert Comment

mlmcc left out the closing quote at the end of "Delivered".

I don't use charts, but if I'm following, and you have other cases where something could be after the status, like "Ordered - 09/01/2012", then you'd need to add those to the formula.  For example:

if {MYTABLE.Progress} like "Delivered*" then
"Delivered"
else
if {MYTABLE.Progress} like "Ordered*" then
"Ordered"
else
<tests for any other values that could be followed by something else>
else
{MYTABLE.Progress}

FWIW, if you could use some general rule for the end of the progress value, then you could have the formula just remove anything that was after that (as opposed to checking for specific values).  But if you've got values that include spaces, like "In Picking", coming up with a general rule to determine the cutoff point could be difficult.

James
0

LVL 11

Author Closing Comment

That was exactly what I needed.  (It also resulted in a "duh!" moment for me).

Thanks
0

LVL 11

Author Comment

James0628,

I know you expanded on mlmcc's response, but what he posted was enough.  I'm sure you understand.
0

LVL 34

Expert Comment

No problem.
0

## Write Comment

Please enter a first name

Please enter a last name

We will never share this with anyone.

## Featured Post

### Suggested Solutions

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
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…
how to add IIS SMTP to handle application/Scanner relays into office 365.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

#### 737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

#### Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!