Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# how to create chart using data points from calculated formula

Posted on 2004-04-14
Medium Priority
1,429 Views
I have linked tables that show patients, labs, and values over time.  the following formula suggested by "EE" Peter, works to give me the number of patients who have a certain labtest type & result within a given range.  using this and similar formula i am able to get an overview patient population.  i would like to display these results in a chart format, yet whenever i try to use a formula field in a chart, i receive the message "A print time formula that modifies variables is used in a chart or map"

i thought i could use the Nth largest of the formula, or the maximum or Last.  i'm unsure what direction to go next.  i need to have the "chart-able" numberic result equal to the total number of patients whose labs fall into each of the different ranges.

numbervar knt1;
if {mytable.mydate}= Maximum ({mytable.mydate}, {mytable.PatientID}) and
{mytable.Labvalue}< 6.5 then
Knt1:= Knt1+1;
knt1
0
Question by:ellendavidson
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 3
• 3

LVL 101

Expert Comment

ID: 10827844
Which section are you putting the report in?

mlmcc
0

Author Comment

ID: 10828363
i have only tried putting the report in the Report Header
0

LVL 42

Expert Comment

ID: 10829341
I think you're trying to use variables in a chart that are still being updated at the time the chart is being rendered.

One way to work around this would be to create a subreport with as many parameters as the number of values you're looking for (This only makes sense though if you have a reasonable number of values to pass - you don't want to have to pass 100 parameters!).  Create a chart in this subreport based on the parameter values.  Now insert the subreport into the report footerB of the main report and link the final values of the variables to the subreport's parameters (You can't actually link a variable - you'll want to create formulas in the report footerA that return the variable's values and link these formulas to your parameters).

I don't have Crystal on this PC so I can't work out exact syntax but hopefully this is enough to get you started.

frodoman

0

Author Comment

ID: 10837019
hi frodo-man
i read your solution and thought Eureka! Aha! yes, of course that's it.  but the translation into making crystal reports perform the way i want is just not happening.  there must be a way, and i am just not approaching this correctly.

i have a formula that creates a value [count the number of patients whose latest lab value falls within a certain range].  i would like to include the formula result and the others like it, in pie chart form, to show the breakdown of lab values across a patient population.

any ideas?
0

LVL 42

Expert Comment

ID: 10842459
Sorry - I got focused on the formula that you already had and neglected the easy approach...

Create one formula called "Catagory" like this and drop it into the details section of your report:

if {mytable.Labvalue} < 6.5 then
(
"Less Than 6.5"
)
else
(
If {mytable.Labvalue} >= 6.5 and {mytable.Labvalue} < 12 then
(
"6.5 - 12.0"
)
else
(
"Over 12"
)
)

Now just insert your pie chart and set it to "OnChangeOf" = @Catagory    and "ShowValues" = Count of @Catagory.

I believe that'll give you your pie chart.  You can of course suppress the @Catagory formula so it isn't visible on your report.

frodoman
0

Author Comment

ID: 10861335
hi frodo man
that gives me a beautiful chart.  thanks.  one more question though.  in my list of lab values, patients will have more than one date with result.  the chart is counting labs that don't fit into one of the three categories (since they are not the latest lab results for the patient(s), and giving me a fourth section of the pie.  the first three sections of the pie, count accurately the number of latest labs that fit into that category, the fourth pie slice has no label.  how can i exclude the values that are not the latest lab values?
e.
0

LVL 42

Accepted Solution

frodoman earned 1600 total points
ID: 10868203
Open up the chart expert and hightlight "catagory" under the "on change of" area, then click the 'Order' box.  Select "specified order" from the dropdown (it probably shows ascending right now by default).  Now, just add the catagories that you want to appear on the report.

For the first one click "New", then type "Less Than 6.5", then for the criteria enter {@Catagory} = 'Less Than 6.5', etc.  Basically you're explicitly naming the groups that will appear on the chart and the order in which they'll appear.

After naming all the ones you want, click the "Others" tab and select the option to "discard all others" - this will get rid of the unwanted 4th grouping.

frodoman
0

## Featured Post

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. …
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
###### Suggested Courses
Course of the Month9 days, 22 hours left to enroll