Solved

how to create chart using data points from calculated formula

Posted on 2004-04-14
7
1,344 Views
Last Modified: 2012-06-27
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
Comment
Question by:ellendavidson
  • 3
  • 3
7 Comments
 
LVL 100

Expert Comment

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

mlmcc
0
 

Author Comment

by:ellendavidson
ID: 10828363
i have only tried putting the report in the Report Header
0
 
LVL 42

Expert Comment

by:frodoman
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:ellendavidson
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

by:frodoman
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

by:ellendavidson
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

by:
frodoman earned 400 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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. …
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…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now