Urgent help needed: number validation program rule not working - Users entering large numbers

Hi, everyone.

Iam using DHIS 2 version 2.33.3
I have a data element: total sessions attended, value type: positive or zero integer. The same data element is in 5 program stages. I have created a program rule to prevent users from entering a number greater than 6 for this data element, but it does not seem to be working because one of the users has entered by mistake 16120946 and has managed to save the value. I have also tried it in the DHIS 2 demo and it is not working. Maybe something is wrong with the PR.


Hi @hernandezmachava, looks like your Prule is working? perhaps a cacheing issue?—

Hi @Matthew_Boddie,

When entering a value greater than 6, the error is shown. but if you click on complete, the value is saved.
e.g. Below is the data I entered and exported

dataElement value storedBy providedElsewhere completedDate completedBy geometry
jT8zA6rqhna 100 admin FALSE 2020-11-30T00:00:00.000 admin
jT8zA6rqhna 89 admin FALSE
jT8zA6rqhna 5 admin FALSE 2020-11-30T00:00:00.000 admin
jT8zA6rqhna 8 admin FALSE 2020-11-30T00:00:00.000 admin
jT8zA6rqhna 5 admin FALSE 2020-11-30T00:00:00.000 admin
jT8zA6rqhna 2 admin FALSE


HI @hernandezmachava makes sense. However when i go into the tracker capture and select that I would like to edit the data, it doesn’t let me call the data complete until I fix the error:
image I don’t think this will work retroactively, but presumably would prevent you from entering in data >6 in the future.

Hello @hernandezmachava
In your case try to choose the Program stage name in “Trigger rule only for program stage”, in order to check that rules inside that particular stage.
When you create “Define program rule actions”, try to choose a field name in “Tracked entity attribute to display error next to”. It will prevent the user to pass to the next field if you have an error and also will clear the entered value.

Additionally I can suggest just to add &verbose in the end of your request string in address bar, and open Console, so you can see which rules are working and what was the result of the program rules.

Good luck!

Hi @Matthew_Boddie,

I will test future entry of data to see if the program rule works correctly.

Thank you again for your help.

1 Like

Hi @Ulanbek,

Thank you for suggestions.