Report date in program rules

Hi all,

I have five stages named observation 1, observation 2, observation 3, observation 4 and observation 5.

I renamed the event/report dates: date of observation 1, date of observation 2, etc.

I want to validate these dates so that date of observation 1 < date of observation 2, date of observation 2 < date of observation 3, date of observation 3 < date of observation 4 and date of observation 4 < date of observation 5.

Is this possible in DHIS 2?



Hi @ferdinandmussavene

I don’t think there is a function or variable for that but one workaround could be store each date in a data element per stage and then create an “Error on complete” or “Show error” action comparing the dates.

  1. In this example I have 3 stages (stage 1, Stage 2 and Stage 3) and in each one I added a data element to save the value (I tried this with calculated variables but the outcome was not the same):

  1. I created the variables for those 3 data elements using the source type “data element from the newest event in the current program”.

  2. I created three “Assign value” rules (one per stage) to assign the amount of days between the event date and the current date. Is important to prioritize the assignment over the error message.

  3. Finally I created the “error” rules. Since I’m storing the amount of days, the condition was configured to show an error if stage2’s number of days was greater or equal to number of days in stage1. This comparison will depend on what you save in the DE

Here is the json file of my program in case you want to play with it in the demo server .
metadata.json (100.8 KB)

Hopefully you’ll find a less complicated solution. Let me know how it goes.


Hi @nancyesp

Thank you for your response. I will follow the steps you have described.