I need help correct a program rule behavior

Hi everyone,

In a repeatable stage, I have a yes/no data element to track. That is, if the answer to this DE is No four consecutive times, then display a message and block program stage for future data entry. In other words, if the answer to the DE is No for 1st, 2nd, 3rd and 4th visits consecutively, display a message and block user input for the program stage). I have taken the following series of steps:

  1. I created a counter as a data element and a program variable for this DE.
  2. I created a program rule to count number of no answers.
    PR expression: d2:hasValue( V{enrollment_date} ) – which means mean trigger the rule when the enrollment date is selected.
  3. I created program rule action: assign value to data element counter:
  4. expression to evaluate and assign: d2:countIfValue( DE, ‘false’ )

When entering data and selecting No for 4 consecutive visits, I see the counter working properly, but the following program rule to trigger a message if the condition is met does not work.

V{program_stage_id} == ‘program Stage uid’ && V{event_count} == 4 && counter == 4. If this condition were met, an error on complete or show error message should be triggered.

This is an example in demo


A post was merged into an existing topic: Tracker - Help correct a program rule for a specific data element