Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1444
  • Last Modified:

how to create chart using data points from calculated formula

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
ellendavidson
Asked:
ellendavidson
  • 3
  • 3
1 Solution
 
mlmccCommented:
Which section are you putting the report in?

mlmcc
0
 
ellendavidsonAuthor Commented:
i have only tried putting the report in the Report Header
0
 
frodomanCommented:
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
Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

 
ellendavidsonAuthor Commented:
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
 
frodomanCommented:
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
 
ellendavidsonAuthor Commented:
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
 
frodomanCommented:
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now