Assign value from previous variable

hi everyone
i did program rule :-
the action is assign value to data element
the variable source data element from previous event
It works well if there is a difference of one day or more between events, but if two events occur on the same day, it does not take the value of the previous event on the same day, but rather takes the value of the event that precedes it by one day.

Hi @emad

Would you please share the program rule configuration so I could test this on play.dhis2.org?

Thanks!



Hi @emad

It appears that this issue might be because of the condition expression. Since this program rule action needs to run whenever there’s a new event, you might want to try an expression that will be revaluated when a new event is created. Would you like to test V{event_count} != 1 for example?

Please test and tell me if it works. :pray:

Thanks!

It didn’t work.




Note that the Stock on hand in the third event returned to 100.