The rule you mention in point 2 above:
- 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.
Make sure in this rule that you assign for example “1” in the priority field of this program rule. Making it priority 1 will make sure it runs before all other rules with either lower priority, or no priority. Priority is entered in the first screen creating or editing the program rule. The reason you need priority is that you have another rule(showing an error on complete) that relies on the program rule for assigning counter to run before it.
In your assign action from point 3 above:
- I created program rule action: assign value to data element counter:
Make sure to assign both to the data element, and also to the program rule variable that belongs to this program rule variable: