Built in variables not showing expected behaviour

Hi everyone,
I have created a data element counter to count the number of events being filled, but the counter is not showing the expected result.


  1. I created a program variable called counter and chose the DE
  2. I created a program rule with the following expression
    d2:hasValue( V{enrollment_date} ) to trigger the rule when the enrollment date is selected.
  3. I created a program rule action to assign value to counter data element
    Expression to evaluate and assign: V{event_count}


  1. The program rule is not triggered immediately unless I click on the stage.
  2. The counter begins at 1, which is correct but when I fill the event the second time the counter becomes 2 in both first and second event. (this is confusing for the user because I expected to see 1, 2, 3 … as the user continues entering data for the program stage)

First visit counter = 1

Second visit counter = 2 but when the user clicks back on the first visit the counter shows 2 not 1 as seen below.

Is this the correct behavior when using V(event_count)?
How can I configure the program rule to show correct numbering in ascending order- 1,2,3,4…


Thank you for reaching out @hernandezmachava! @Markus would you look into this? Thanks!