Web and android - Program rule does not hold

Hi, everyone

I have built a program rule to hide a repeatable program stage, but the problem is that the PR does not always hold true. The program rule works the first time. In the image below, when I try to add more events than those defined in the program rule expressions, it shows the following message: β€œAll the expected events are already present, cannot create more events.”, which is correct.

But when I close the message, hit the back button and click again on the tracked entity and click the add button, it allows to add to more events.

This is after clicking the tracked entity after clicking back. Now the PR is not validating

The program rule is not always holding true since I expected to see the same message preventing me from adding events whenever I try to.
Is there any reason for this program rule behavior behavior? This is a very important validation for my use case.

Hi @hernandezmachava . Do you have the same behavior in Android? Could you please share the Program Rule?


Hi @jaime.bosque,

Yes, the program rule is not working on android either.

Below is the program rule. It is based on a compulsory data element that is always filled. If this DE is filled twice, the program must hide the program stage and not allow more events to be entered in this PS. The user should always see a same message preventing him/her when he/she tries to add a third event.


Hi @hernandezmachava,
a couple of question to understand better the issue
What is the source type of Program Rule Variable #{Paciente esta dentro da sua area de alcance}?
What is the version of DHIS2 running?


1 Like

Hi @enrico

I am using DHIS 2 version 2.34.4

The source type of the Rule Variable is: Data element from the newest event for a program stage