I've created a Family Planning VFE form that will be launched using a quicktext INSERT_FORM_COMP and would like to push a Family Planning Dx code with the function of just opening the form.
Is it possible to use an IF statement that is always true, possibly using patient.sex attribute, creating a function call for both "M" and "F".
However this doesn't work when opening the form on a test female patient:
{IF (PATIENT.SEX)== "F" then
(MEL_ADD_PROBLEM("note:", "Family planning", "ICD-V25.09", str(._TODAYSDATE), "", ""))
endif}
Is there something wrong with this syntax? The MEL_ADD_PROBLEM function works fine when using the IF statement with one of the form's document variable values selected in the form, but I would like to push the problem code by just launching the form.
Has anyone created an always true or constant function within a form?
put an ! before the IF...forces code to execute at form load.
Yes, that works perfectly. Thank you 🙂
Well, there is a slight problem... the Dx is added every time the form is reopened. The provider may choose to go back in to enter something and they'll end up with duplicate Dx entries.
Is there a way to limit to adding the problem only once? While using the !IF and always true statement?
I'm working on another check box solution in the meantime.
Here's a form we use for adding common problems:
The code in the code window checks if a problem is already in the patient's list. You can use the part of the function that checks.
Thank you, I'll check that out.
Another thing I noticed is it's also adding the obs term NKPROB, even when I change the argument type from "Note:" to "DX OF", the NKPROB still gets pushed.
Is it possible to stop that from happening when using this?
{IF (PATIENT.SEX)== "F" then
(MEL_ADD_PROBLEM("note:", "Family planning", "ICD-V25.09", str(._TODAYSDATE), "", ""))
endif}
Doesn't happen with our form. Can't see any reason in the help doc. Are you sure ICD-V25.09 is valid???
It appears this is only happening in the EMR9.0 evaluation version I use for testing. I imported into our CPS10.0 production environment and it's no longer an issue.
Thanks,
Anna
add this line between the if and then so it doesn't add the problem more than once -
match(PROB_AFTER(),"V25.09")<1
so it reads
IF (PATIENT.SEX)== "F" and match(PROB_AFTER(),"V25.09")<1 then
the function will try to execute every time the form is open but it won't add the problem if it is already on the problem list
Thank you