# Assistance: Program rule to show multiple data elements

**URL:** <https://community.dhis2.org/t/assistance-program-rule-to-show-multiple-data-elements/42178>\
**Category:** Support - Assistance technique\
**Created:** [4 March 2021 13:20 UTC](https://community.dhis2.org/t/assistance-program-rule-to-show-multiple-data-elements/42178 "2021-03-04T13:20:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmbantu](https://dhis2.b-cdn.net/letter_avatar_proxy/v4/letter/d/85f322/32.png) [@dmbantu](https://community.dhis2.org/u/dmbantu)\
**Post date:** [4 March 2021 13:20 UTC](https://community.dhis2.org/t/assistance-program-rule-to-show-multiple-data-elements/42178/1 "2021-03-04T13:20:17Z")

</div>

Hi all,

I have **4 Yes Only data elements** and **4 text fields data elements**. If **A1 and A2 Yes Only DEs** are selected, only **A1 and A2 prevention priorities DEs** should be shown and so on. What we have in program rules is **Hide Field Action**. We do not have a **show field action.**

 ![image](https://dhis2.b-cdn.net/uploads/default/original/3X/f/9/f91fa2998a0bd3704e3505c1007cb0653421db15.png)  
In my case, if a Yes Only DE is chosen, I would like to show the corresponding text field data element. How can I achieve this?

Thanks

---

<div class="post-metadata">

**Author:** ![brian](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/brian/32/48251_2.png) [@brian](https://community.dhis2.org/u/brian)\
**Post date:** [4 March 2021 14:37 UTC](https://community.dhis2.org/t/assistance-program-rule-to-show-multiple-data-elements/42178/2 "2021-03-04T14:37:34Z")

</div>

Hi @dmbantu ,

If you would like to hide a field by default, and show the field upon some condition, then you can negate the program rule condition with `!` and make “Hide Field” the program rule action.

As an example of this you can observe the program rule and behavior for “WHOMCH Chronic Conditions” question under the [WHO RMNCH Tracker program in Play demo](https://play.dhis2.org/2.35.1/dhis-web-maintenance/#/edit/programSection/programRule/ruleonr1055)

Condition: !#{chronicconditions}  
Actions: HideField

![rmncah_tracker_showHide](https://dhis2.b-cdn.net/uploads/default/original/3X/1/a/1a28a8ce48f1436fb50d9ed3968a8e72bf8a0b99.gif)

This would also work with Yes Only DEs.

---

<div class="post-metadata">

**Author:** ![dmbantu](https://dhis2.b-cdn.net/letter_avatar_proxy/v4/letter/d/85f322/32.png) [@dmbantu](https://community.dhis2.org/u/dmbantu)\
**Post date:** [5 March 2021 10:00 UTC](https://community.dhis2.org/t/assistance-program-rule-to-show-multiple-data-elements/42178/3 "2021-03-05T10:00:45Z")

</div>

Hi @brian,

Thank you very much. The steps you have provided have solved my problem with Yes Only Des, but two questions have arisen: I am unable to hide/ show program stage following the same steps.  
I have an attribute type of visit with an option set attached to it: Type of visit (VA, PS). If VA is chosen, only VA\_Test program stage must be shown, i.e, hde PS\_Test PS. Below is how I built the program rule:

 ![image](https://dhis2.b-cdn.net/uploads/default/original/3X/6/d/6d65e31dc2a2915d9f5e418f3243c3054d0ce720.png)  
 ![image](https://dhis2.b-cdn.net/uploads/default/original/3X/0/b/0b8a0b644e74728241376ce657f1a718c51cbfc2.png)  
 ![image](https://dhis2.b-cdn.net/uploads/default/original/3X/8/9/89f82d414a6ae9c60194a80d0ad7ebaf5e390434.png)

I have also tried this condition, but it doesn’t work

 ![image](https://dhis2.b-cdn.net/uploads/default/original/3X/2/6/267b5a241a44603cb8fb1ecb896a24e8ca294804.png)

Thank you again
