Bug or Form Issue?
Configured a userok to open a form component -- after clicking OK, Centricity crashes with the message: Error occurred in class, method CNoteView::OnOpenFormComponent
userok programming: userok("! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !" + HRET + HRET + "Go to the CLINICAL DECISION SUPPORT" + HRET + "form to view this patient's alerts!" + HRET + HRET + "! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !")
OPEN_FORM_COMP("Enterprise\AHNE\Clinical Decision Support")
CPS 12.0.7
Is the form already part of the chart update when you call OPEN_FORM_COMP? If not, you will need to use ADD_FORM_COMP to add the form to the note.
Yes, it is in the Document Template, and it is above (to be inserted into the note before this form is "read") the one generating the userok dialog.
If I move the form to BELOW the one calling the userok dialog, I get the error that the form component cannot be found and to insert it into the note.
Where is this MEL code located? Is it in the document template? Called by a button in the chart update?
No, it's within another form inserted with the document template... Form A generates popup to open Form B
Is this code executed with the click of a button, or is it executed as the form is loaded as part of a watcher expression?
As the form is loaded.
The issue might be with the way the EMR loads forms/variables and executes watcher functions. One idea would be to: (1) move the MEL logic to a text component; (2) call this text component as the last line of the document template. I'm thinking that this will allow all the forms to finish loading, and only then execute the MEL.
I went ahead tried that (thought you may suggest it from the previous replies 🙂 ), but am getting compiler errors over and over. Here's the full MEL:
{IF
USER_JOBTITLE() == "Physician"
THEN IF
DOCUMENT.USEROK == "Seen"
THEN ""
ELSE IF
(
OBSNOW("SMOK STATUS") == "Current every day smoker"
OR
OBSNOW("SMOK STATUS") == "Current some day smoker"
OR
OBSNOW("SMOK STATUS") == "Smoker, current status unknown"
OR
OBSNOW("SMOK STATUS") == "Heavy tobacco smoker"
OR
OBSNOW("SMOK STATUS") == "Light tobacco smoker"
)
OR
(
(OBSNOW("WEIGHT") < LASTOBSVALUE("WEIGHT")) AND
MATCH(PROB_AFTER(),"cancer") >0
)
OR
(
(MATCH(PROB_AFTER(),"389.9") >0
OR
MATCH(PROB_AFTER(),"389.00") >0
OR
MATCH(PROB_AFTER(),"389.20") >0
OR
MATCH(PROB_AFTER(),"389.10") >0)
AND
(val(LAST_SIGNED_OBS_DATE("AUDIMTR TYPE")) < val(subtractdates(str(._todaysdate),"","","180")))
)
OR
(
MATCH(MEDS_AFTER(),"FLOVENT") >0
OR
MATCH(MEDS_AFTER(),"FLUTICASONE") >0
)
OR
(
MATCH(MEDS_AFTER(),"OMEPRAZOLE") >0
OR
MATCH(MEDS_AFTER(),"PRILOSEC") >0
)
THEN
userok("! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !" + HRET + HRET + "Go to the CLINICAL DECISION SUPPORT" + HRET + "form to view this patient's alerts!" + HRET + HRET + "! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !")
OPEN_FORM_COMP("Enterprise\AHNE\Clinical Decision Support")
ELSE ""
ENDIF
ENDIF
DOCUMENT.USEROK = "Seen"
ELSE ""
ENDIF
}
On open, an update is firing a lot of code, most importantly, processing ALL code for each form so that the data is properly refreshed. When starting an update, this can be especially problematic and requires thinking through how things work to successfully pull off. You might consider adding a global 'loaded' trigger to the update that fires the USER OK from a 'safe point'. Alternatively, instead relying on the timing for MEL execution, you could check if the form is present by using GET_FORMS_LIST() and managing it from there. Regardless of which approach you utilize, you MUST allow the initialization process of the entire update to complete it's cycle. Review a MEL trace or two to find that point and be certain to not trigger the USEROK prior to it.
I took a look at the code and nothing obvious jumped out at me. In similar situations, I add a button to the form that fires the code on click; before clicking, I turn on MEL Trace (CTRL+ALT+M) to isolate the MEL trace to only the button clicked. Once you have the MEL Trace, you have a good shot at deciphering what's happening.