Hello awesome helpful people!!
I am creating a new document and within the document I was wondering if there is a way to do something like if 'Yes' to a question it can automatically add a document to the left hand list to be completed next?
Also, if they accidentally click 'Yes' and then click 'No' would it remove this form and if not is there a way to do so?
Thank you all!!
Have you looked at these functions in VFE Editor?
ADD_FORM_COMP()
REMOVE_FORM_COMP()
{if DOCUMENT.QUESTION == "Yes" then
ADD_FORM_COMP(...)
else
REMOVE_FORM_COMP(...)
endif}
Where DOCUMENT.QUESTION is a form field asking the question.
Sure.
What you are looking for is ADD_FORM_COMP(), REMOVE_FORM_COMP and GET_FORM_LIST(). Take a look at Centricity help it has a good entry on these functions. From the help entry they provide the following example.
{ADD_FORM_COMP('Enterprise\Medicalogic\Exam','Vital Signs',’AFTER CURRENT’,’OPEN’)}
In the example above, the first argument is the path of the form, the second argument is the title, the third is where it should be placed in the list of forms - in your case it sounds like 'After Current' is the correct option), and finally the last argument indicates if the form should be opened right away.
REMOVE_FORM_COMP() acts is a similar manner but only asks for the form name.
GET_FORM_LIST() will return the forms current present in the visit. This will help prevent trying to remove a form that has already been removed, or add a form an second time. This may throw an error is you don't check for it. Using these functions you could write a watcher like the following. I am assuming you are putting your yes/no value in the obs term "WEIGHT" and want to add a Vital Signs form:
{!
if (OBSNOW("WEIGHT") == "yes" AND (match(GET_FORM_LIST(),1,"Vital Signs") ==0) then
ADD_FORM_COMP('Enterprise\Medicalogic\Exam','Vital Signs',’AFTER CURRENT’,’OPEN’)
else if (OBSNOW("WEIGHT") == "no" AND (match(GET_FORM_LIST(),1,"Vital Signs") > 0) then
REMOVE_FORM_COMP('Vital Signs')
else
""
endif
endif
}
You will need to modify the function above, but hopefully it is enough to get you started. Also please check for any syntax errors since the example above was off the top of my head.
thank you so much everyone!!!!!!!!!!!!!!! that was very helpful. I got it working!!!!
Important note on removed forms:
While the form is visibly removed from the update - the MEL code and DOCUMENT variables it used are NOT. When the update is put on hold, the MEL code is removed from the update, however, the document variables will still remain in memory.
This is important to realize because, in the removed form, if you have checked 'make available to other forms' in VFE or declared them globally in MEL, they can still impact other forms in the udpate that share the same variable.
Lastly, if the removed form populated any obsterms, those obsterms will remain populated. Ideal in some instances, but as users want more automation for meeting reporting requirements, it becomes a liability, both in terms of medical-legal and data integrity. Similarly, any documentation that supported population of the obsterm(s) will be visibly removed from the note, unless it is represented elsewhere, and can jeopardize the legal defense of the data both in court and in a reimbursement claim dispute.