When I add a form to UI using configure metadata>manage form there are several options including for example Icon style, Order, etc.
see picture below
My question is related to SHOW IF.
I need to show specific forms for a
1- Given location
2- Given Gender (Male/Female)
3- Given Age (for example patient age > 16 )
4- Given patient ID : for example ID starts with a given character or number
5- Given patient name
I tried so many times to play around it but I could not figure out how to do this. The result that I keep getting is the disappearance of the form completely. If anybody can help me with this I will much appreciate it
Thanks in advance
@yadamz I had the same challenge which was resolved here by adding the data to my from metadata How to add/remove fragments from dashboard & link forms
The forms are added to the patient dashboard when you are viewing a specific patient so checks #4 and #5 are not relevant
The additional checks on the UI could be added as follows:
location.id = 4 && patient.person.gender==‘M’ && patient.person.age > 16
Note the use of HTML entities for special characters & for & and > for > which
Stephan… you are Amazing… Thanks very much
One question: where do I find a list of these codes:
patient.person.age > xx
Is there a place where I learn them…
For example: If I need a special form for a given diagnosis… How do I learn to develop a code for it.
Not me, the OpenMRS community is
My understanding is that those are attributes of a person, so you can leverage the scheme for visits, encounters etc. I am not sure if there is a single place to learn them, they are based on what you need.
For forms, I would go to the HTML form entry module https://wiki.openmrs.org/display/docs/HTML+Form+Entry+Module+Getting+Started and base on sample forms like https://github.com/openmrs/openmrs-module-referenceapplication/tree/master/omod/src/main/webapp/resources/htmlforms in the reference application
The overall feature is documented on the Configure Metadata: Manage Forms wiki page.
Documentation (of low quality) on what variables are available in the show if expression are described on the Conditionally displaying Apps and Extensions wiki page.
Thanks @darius I could not figure out how t use that document to find out the expression for
1- show if: user role == Organizational: Doctor, for example
I appreciate this your help
For that specific use case, you should not actually be using “show if”. Rather you should create a Privilege like “Application: Enters Xyz Form” and then assign this privilege to the appropriate roles.
The Manage Form UI lets you specify a required privilege (and this is applied before even doing the Show If test).
Hi @ssmusoke, @darius I am trying to configure an ANC Form to be displayed on the Patient Dashboard - Current Visit Actions only if the selected visit type is ANC.
So far I have tried setting the Show If configuration as follows but no luck in all these cases. Could you please help shed some light here?
I do not think VisitType is supported within the configurations, I am only aware of locations at this point which is what we use.
See this thread Displaying HTML entry forms based on login session in reference application
Okay that sheds some light, I think we can create some child login locations for the different visit areas for example Maternity Ward and then display only Maternity and delivery forms for people logging in to the location. Would that work, you think?
OK. Am sure this helps. Thanks a lot.