Program rules - comparing report date for multiple stages/events

Hi devs, is it possible to compare event dates from different program stages?

We have some stages that should happen chronologically (treatment start stage should be before treatment outcome stage), and I’d like to ideally have a hard rule preventing this, and if that’s not possible, to at least be able to show a message/warning

Regards
Olav

Hi Olav!
There is currently no way of getting the last event date of a program stage directly, but there is a function that might help you.

d2:lastEventDate('variableName') - will give you the event date when the underlying data element was entered. Based on how your program stages and data elements is structured you might use this function.

Another option that might solve your problem in a simpler way is to use program rule variables with the "Data element from previous event". But again - only if you have a data element that you can use for validation in the previous events.

You are also most welcome to make a jira issue requesting a function that does not rely on the data elements :slight_smile:

Markus

···

18. jan. 2018 kl. 15.31 skrev Olav Poppe <olavpo@ifi.uio.no>:

Hi devs, is it possible to compare event dates from different program stages?

We have some stages that should happen chronologically (treatment start stage should be before treatment outcome stage), and I’d like to ideally have a hard rule preventing this, and if that’s not possible, to at least be able to show a message/warning

Regards
Olav
_______________________________________________
Mailing list: DHIS 2 developers in Launchpad
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : DHIS 2 developers in Launchpad
More help : ListHelp - Launchpad Help