I’m trying to create a pivot table that shows the number of days since the last event created in a tracker capture program. The goal is to monitor whether maintenance is being performed periodically as intended, and to flag water points that are overdue for maintenance.
I created a data element and used the following program rule action: assign value (d2:daysBetween(V{event_date}, V{current_date}))
This works perfectly at the time of data entry—however, the value remains static. For example, if the days between is 4 today, it will still show 4 tomorrow, even after running data analytics. The only way to update it is to reopen the event and save it again.
Is there a way to make this calculation dynamic (i.e., always reflect the current number of days since the last event) without having to manually re-save events?
Thank you for this question. You’re already on the right track with one minor difference, you’d need to use a Program Indicator instead of a Program Rule. In a program rule, “current_date” is the date of the program rule’s execution whereas in a program indicator, “current_date” is the date whenever the analytics run.
‘PS_EVENTDATE:(programStageUid) to compare the latest event date from a given program stage.’
Please know that if we use a program indicator of enrollment type, analytics will need to be rerun for the values to be updated; however, if we had used only the “event_date” it will get the latest event date in all of the program stages within the program.
Please give it a try and let us know how it goes. Thanks!
Thank you so much. It worked perfectly. I am currently trying to transition some forms away from SurveyCTO, as I believe DHIS2 may be able to handle the follow-up functions and dashboard functionalities more effectively.
Your help is truly appreciated. If I eventually win the race, I will definitely let you know so we celebrate.
Yes. Got the task. Starting development now. The QR code scan function which was part of last year’s LMIS training in Rwanda will be needed for this module. I’ll check back here for the setup steps once I am at that point. Thank you @Gassim