Dear @hio.amakomaya ,
I am not sure whether this is the best solution to achieve it, but we use a data element “Event number” to store the number of events from a specific stage.
We use 2 program rule variable:
“Event Number previous” (which retries the value of the data Element “Event number” from last event in the given stage.
“Event number” which is the value of current DE '“Event number”
We use 2 program rules, to assign the value “1” for the first event (Condition = !d2:hasValue(#{Event Number previous}) && !d2:hasValue(#Event Number)", and another Program rule for the following events, where we assign the value ("Event Number preivous +1) to the data element “Event Number” (condition = d2:hasValue(Event number previous}) && !d2:hasValue(Event number) && (#{Event Number - Event Number previous} <2)
Please see this post where we discussed with DHIS2 team about this kind of counter:
Tracker Android Capture program rules - Visit incrementation - Support - Assistance technique - DHIS2 Community
We can then have program rules conditions based on the variable “Event number” to hide field or assign values.
Hope this helps