I am trying to come up with some way via quick text or handout/letter to come up with a way to show a person's target heart rate using the heart rate reserve formula. Heart rate reserve = (220-age) - resting pulse. To get a target exercise heart rate of, say, 50% of your heart rate reserve, you would calculate it, take 50% of it, then add it back to the resting pulse. I have come up with a way to calculate the heart rate reserve:
{global mhr = (220-(PATIENT_AGE()))
global op = "-"
global hr = (OBSANY("PULSE RATE"))
eval(mhr + op + hr)}
I can't figure out, though, how to go from there to take a percentage of it and add it back to the pulse. Any help?
John Metz
You are trying to mix values and strings, that is why it isn't working, to convert a string to a value use val() and to go the other way use str(), the calculation could be done with
str(220 - val(PATIENT_AGE()) - val(OBSANY("PULSE RATE")))
Michael -- tried what you suggested but got no output from it. I even tried enclosing your MEL statement in curly braces and still got nothing. Any other thoughts? Thanks!
John Metz
Yeah, I tried it myself and Patient_Age() returns a value, so this works -
str(220 – PATIENT_AGE() – val(OBSANY("PULSE RATE")))
Make sure you copy and paste into notepad first and then into Centricity, or just re-write it yourself, otherwise you could get an error.
Michael -- thanks again, but I am still not getting any output from your formula. I did what you said and then posted it in a letter template to test it out and all I got was the MEL statement. Not sure what I am missing.
In a broader sense, if one wants to do math functions (adding, subtracting, etc.) would it be a correct assumption that every item would need to be a value, and not a string?
Thanks for your input.
John Metz