Increment program rule not working

Hi, all.

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, display a message and block user input for the program stage). I need a counter

I did try this, but it is not working. There may a syntax problem in this rule or the PR does not make sense

V{program_stage_id} == ‘H1r8g2lxK4i’ && V{event_count} == 4 && d2:countIfValue( #{ARCO_Was the patient found}, false ) == 4

Did you try to have a program indicator count the No and then create a program rule which have in its condition the program indicator?

Hi @SDKAAA,

Below is the way I built the program indicator to count the number of No answers, but the filter is giving error. Maybe something is wrong.

Aggregation type: count

Analytics type: event

Expression: V{value_count}

Filter: ARCO_Was the patient found==No

A part from the Program indicator issue, I am wondering if you could show me how to have the program indicator as a condition in the program rule.

Thanks.

Hi @SDKAAA and every one,

I seem to have made progress but I think I am missing something, Please see and comment on my 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} ) - to 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.

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.

Thanks

Thank you for your patience @fernando ! I have sent @dhis2-tracker team a message to support you.

I moved the topic you just created back to this topic so that the discussion can be continued rather than separated. Thank you @fernando !

Hi @Gassim,

Hi, has there been any progress on this?

Thanks

1 Like