In this example we will create a simple program rule which hides Pregnancy status if the selected Gender is Male.
In order to create a new program rule, navigate to Apps->Programs/Attributes->Programs
Select the program, followed by “View program rules” in order to go to the program rule management screen.
From the program rule management screen click on “Add new” to add in a new program rule.
Provide the rule with a name and description (for example, Hide pregnant IF gender = male). Now we can proceed to define the rules parameters.
- Click on “Add source field.” A pop-up will appear.
- Select the source type, program stage, data element, and provide a variable name. Click on “Add” when these have been defined.
- Select the source field, as this will move it over as a variable to the expression selection.
- Define your expression. In this case, we want to hide a field when gender = ‘Male’
- Select the action that occurs when gender = ‘Male’
- Add a message that describes the action. Can also be used when the action is prompting the user.
- Select the field in which to execute an action (in this case, hide field)
- Add the program rule when all is completed by clicking “Update”
For more on program rules, including creating advanced or multiple condition based rules, make sure to visit the DHIS2 documentation.