Hello fellow users,
I have the chart note of a data display calling a function to print. I am using the same function to print to the data display within the form as well. The form behaves as I expect until a value in the form is changed.
For example, if I ask:
Was the patient prescribed aspirin?
My form, and its chart note, will both read "No."
If I then add aspirin to the list of patient medications, the data display within the form will read "Yes", but the chart note reads "No."
Is there a way for me to force the chart note to execute the function if the data display changes? The code I am using to handle printing inside the chart note is:
{
if(check_for_gilenya <>"") then
check_for_gilenya()
else
""
endif
}
Try putting an exclamation point after the first curly bracket. That will cause it to execute when changes are made.
David Shower
OU Tulsa School of Community Medicine
(can we please set some sort of automatic signature? )
Thanks for the response. Adding the exclamation point did not fix my issue. My code now looks like:
{! if(check_for_gilenya() <>"") then
check_for_gilenya()
else
""
endif
}
Because the function check_for_gilenya() will always return either yes or no, I also tried:
{! check_for_gilenya()}
I'd like to reiterate that the data display has type MEL Expression, that the code used to write to the data display is also used to write to the chart note, and that the data display in the form is updating when a change is made but the chart note is not.
Does anyone have any other ideas? Maybe this is a result of a stupid mistake? Any help is greatly appreciated.
-Sean Davis
I don't think the translation will re-evaluate the function unless you put the document on hold and reopen it. To get around it I would either change the function so that you pass a variable to it that changes, such as
check_for_gilenya(MEDS_AFTER())
to have it evaluate anytime the patient's medications change. Or set a document variable equal to it in the white space off to the side and put the document variable in the text translation instead of the function (and also in the mel statement.)
Thats what I would try, good luck
Mike