udakaya
(udayanga yapabandara)
8 November 2022 04:35
1
I have made a DHIS 2 form to collect information regarding maternal and child health and need support to formulate a program rule for the following.
In the form, there is a section to enter the period of amenorrhea (POA), if the POA is less than 34 I want the following options to show namely
Corticosteroids been administered during pregnancy?
Magnesium sulphate been administered during pregnancy?
if the POA is more than 34 weeks I want the above two options to hide.
Please kindly demonstrate a possible program rule
1 Like
Gassim
(AL-Gassim Sharaf Addin)
8 November 2022 13:37
2
Hi
Create a program rule variable of source type βData element in current eventβ and the data element should be the POA
Create a program rule that will hide the fields when POA is > than 34
Expression: POA > 34
Program rule actions: hide field 1, hide field 2
The two fields will appear by default but once the value for POA is entered it will determine if the options remain visible or hidden. Hope this helps!
1 Like
udakaya
(udayanga yapabandara)
9 November 2022 06:28
3
Hi Gassim,
The program rule worked but when I keep the field blank the two options show but when I enter a value more than 34 weeks the two options hide.
When the value is empty
When the value is less than 34
when the value is 34 and more
is there a way for those two options to be hidden when the fields are blank
1 Like
Gassim
(AL-Gassim Sharaf Addin)
9 November 2022 09:02
4
Could you please try to create an additional program rule:
Expression: POA == ββ
Program rule actions:
action 1: hide field 1
action 2: hide field 2
So for your use case you will need two program rules the one above and this one:
Hope this solves it! Please mark post as solved if it does. Thank you!
2 Likes
udakaya
(udayanga yapabandara)
9 November 2022 10:13
5
Dear Gassim,
Your expression helped me to solve the issue the expression is {#POA } == ββ
1 Like