Event identifier in a program stage

Dear community members,

I would like to provide an identifier in each event of a repeatable program stage. For example, 1st event is baseline, 2nd event is midterm, and the 3rd event is endline. I was trying to achieve this putting a program rule but no luck (I was trying to put if function in this case for example if event is 1 then assign baseline and so on). To get solution searched on CoP, DHIS2 documentation and demo instance of dhis2.

Adding a question might solve the problem for example if I add a question time line of the event and add three options 1-Baseline, 2-Mid term, and 3-Endline. But i want to achieve this dynamic way.

Thanks,
Arif

Hi @arifazadkhan!

Not sure if those events will be created with the same report dates but if not, another solution is to use variables with source type “Data element from previous event”. Instead of counting events, make the rule to check which value is contained in the previous event and based on that, assign the current value to the data element. For example:

Rule 1 - For the first event
Condition: !d2:hasValue(#{DEPreviousEvent})
Action: Assign “Baseline” to data element

Rule 2 - For second event
Condition: d2:hasValue(#{DEPreviousEvent}) && #{DEPreviousEvent} == ‘Baseline’
Action: Assign “Mid term” to data element

Hope this can help to your configuration. Let me know how it goes.

2 Likes