I create a tracker data element value type: Number
For event program, I want to use program to check and show error if Number is under 18
Can someone show me how to make a program rule to specify that the Number must be> = at 18.
I’m really appreciated if anyone has experience on this can share.
In order to create the Program rule you must first create a “Program rule variable”.
From the “Maintenance” app, click on the “Program” menu and then select “Program rule variable”
Click on the + symbol and you will be able to create a variable that will hold the value of the data element you are referring to.
You will be asked to select which program it belongs to, a unique name for the variable, the source type, the program stage and then select the actual data element.
Click on “Save”, this has now created a variable for you to use in the “Program rule”.
So now click on the Program Rule menu item, click on the + to add a new rule.
The first section will be for selecting which Program and Stage the rule will be bound to and then entering the name, description and priority.
Select the link “2 Enter Program rule expression” at the top and this is where you will evaluate the variable you created in the very first step.
Your expression will look something like this → #{myVariable} <= 17
Now click on the link “3 Define program rule actions”.
Here you can specify any number of actions to take if your expression evaluates as true.
Hi, @Peter
Thanks for the support.
Your approach works well, except that the error message that I entered in link 3 of the program rule appears as soon as the form is opened, while what I want is for the error message to appear after the filling of the appropriate field.
Regards