Avatar of Clif
Clif
Flag for United States of America asked on

Pie Chart

I'm using Crystal Reports XI

I have five values that need to be represented in a pie chart.  These values are in five formulas.  I can get the values in the 'Show value(s)' list in the Chart Expert (and set the data read to 'for all records'), but the pie does not show up.  The legend shows 0% for each of the five values (with a Total: 100%).  I can drop the fields for each of the five formula right next to the chart, and the values do show up correctly.

What am I doing wrong, and how do I do it right?

TIA
Crystal Reports

Avatar of undefined
Last Comment
James0628

8/22/2022 - Mon
IanTh

Mike McCracken

What are the formulas?

mlmcc
Clif

ASKER
IanTh -

I'm sorry, but I cannot view YouTube videos at work.

-----

 mlmcc -

Fairly simple.  It's an addition of one or more of the individual field(s) totals.  What's returned in each field is a month's value (ie Balance_1 is for January, Balance_2 is February etc).  For the report (and chart) I need quarterly values, so I add Balance_1 + Balance_2 + Balance_3 for Q1.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Mike McCracken

Are they PRINTTIME formulas?
Do they have WhilePrintingRecords or use SHARED variables?

WHat does the raw data look like?

mlmcc
Clif

ASKER
Just as a test (and to be able to give y'all data to work with) I have created five simple formulas.  The only value in each forumula is as follows:
Name         Value
AATest_1     formula = 100
AATest_2     formula = 200
AATest_3     formula = 300
AATest_4     formula = 400
AATest_5     formula = 500

Open in new window


The chart is put in a Report Footer (RFb)

Adding 'WhilePrintingRecords' to the formulas doesn't help.
ASKER CERTIFIED SOLUTION
James0628

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Clif

ASKER
Curiously leaving WhilePrintingRecords off makes a difference.

Go figure!

Thanks.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
James0628

CR processes reports in multiple passes.  I don't know off the top of my head what is done when, but the obvious guess is that building the chart is not done in the "print" pass, so including WhilePrintingRecords was keeping the formulas from being evaluated when the chart was being built.

 Which I imagine is why mlmcc asked earlier if your formulas were "print time" formulas.  I thought he was suggesting that they _should_ be print time, but now I'm guessing that he meant the opposite, and they should _not_ be.

 Anyway, I'm glad I could help (even if I had no idea what was causing the problem :-).

 James
Mike McCracken

the printing pass is the last pass through the report.  grouping and charting is done earlier, thus print time formulas can't be used.
http://www.sdn.sap.com/irj/boc/go/portal/prtroot/docs/library/uuid/204c3492-ab1e-2b10-b683-b5e8fe390d70?QuickLink=index&overridelayout=true&29665339124315

I tried what you did James and ended up with  single color chart and 0%.

mlmcc
James0628

Was that with or without WhilePrintingRecords in the formulas?  I did not include that.

 James
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Mike McCracken

You can't use print time (WhilePrintingRecords) formulas in a chart.

mlmcc
James0628

Just trying to clarify.  You said "I tried what you did James", but I did not include WhilePrintingRecords.  I'm guessing that you did, and that's why your chart didn't work.  If you did not include it, then I wonder why your chart didn't work?

 James
Mike McCracken

I used a formula like
Name AATest_1    
  100

Similarly for the others.

I don't know why it didn't work either

mlmcc
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
James0628

Interesting.  I just did some more experiments.

 If I create the chart using "For all records", I get no pie, and 0 % for each formula in the legend.

 If I change it to "For each record", I get a warning that the data and chart type don't match, and when I continue, I get a pie with slices and the correct %'s in the legend.

 If I undo that (Edit > Undo), it goes back to no pie and 0 %'s.

 But, if I go into the Chart Expert and change it from "For each record" back to "For all records" (instead of using Undo), the slices and %'s stay.  I don't know why, but they do.

 When I created the earlier chart, I remember trying both the "For each" and "For all" options, so that's probably why it worked for me.  I may have ended up with "For all", but I probably had used "For each" at some point, and that's why, in the end, "For all" worked for me.

 FWIW:
 I tried saving a report with a "For all records" chart that was showing the pie and correct %'s, and when I re-opened the report and refreshed it, I still got the pie and %'s, so it wasn't just a temporary thing.

 I then added a new chart in that report (each chart in a separate report footer section) with "For all records", and it showed the 0 %'s, while the old chart with "For all records" was still showing the correct %'s.  I thought maybe the evaluation time for those formulas was somehow being changed, but I guess not, since the two charts produced different results.  It must be something in the chart itself.

 James