Hello All,
I need a field to do a (auto)calculation based off of the entered weight of the patient by the end user. This field also needs to be modifiable. Any suggestions on the most efficient fx for this?
Thanks!
Jesse
I'm not sure if this is the most efficient way to do this but we have an auto calculation setup this way:
{!
document.x = str(fnCalcuate(parameter1))
}
The watcher will keep checking to update the document variable. Your weight value can be a parameter inside your function that does the calculation and is modifiable. If/when the weight value changes the auto calculation in the document variable will update as well.
Thank you for the response...
There needs to be a calculation (10 mL / kg). I'm not seeing that in the equation above...
To do that you would write out your function. For example using the name I used above -- also the paramter1 is going to be a document variable or obs term. I'm also assuming that your provider is entering kg here. If not you would need to work in that conversion as well. So, something like this:
fn fnCalculation(weight)
{
return 10 / val(weight)
}
EDIT:
Actually as simple as the calculation is you probably still want to make sure you don't divide by zero or a null since the watcher is running this:
fn fnCalculation(weight)
{
if (weight <> "") THEN
return 10 / val(weight)
else
return ""
endif
}
Hmmm...
Should it be 10*val(weight)?
Also what's tricky is I have the field hiding in a visibility region. The user must place a mark in the check box for the data to populate...
You can do whatever calculations you want in the separate function. The calculations are up to you and your provider. Just know that the value is passed in (in my example I called it weight) and something needs to be returned even if it is a blank string. Regarding the visibility region that is a separate issue...