Help: Challenging use cases

Hi @Markus, @Enzo and @jaime.bosque

I have the following use cases that make me get stuck because I am not able to implement them in the tracker.

Use case 1

We will need to be capturing clinical data for period of 7 months; a month corresponding to one visit/event, i.e, we will be filling out a repeated program stage 7 times and we would therefore like to automatically block future data entry for the program stage when the number of visits reaches 7th visit, but allowing the user to enter data in other program stages within the same program. By doing so, we want the user not be allowed to add the 8th visit/event.

We have created the following program rule expression and program rule action (show error, error on complete) to display a message to the user that says “The number of visits should be 7. The program rule works but after closing the PR action message and clicking on the add button, a new event is added. The program rule and PR action do not prevent the user from adding more events, so I am looking for ways to block program stage for further data entries.

V{program_stage_id} == ‘program Stage uid’ && V{event_count} > 7

Use case 2

I would like to track a yes/no data element in a program stage… That is, if the answer to this DE is No for consecutive visits (A repeatable stage must filled four times?, then block program stage for future data entry. (i.e if the answer to the DE is No for 1st, 2nd, 3rd and 4th visits consecutively, display a message and block user input).

I did try to combine

V{program_stage_id}, V{event_count} and countIfValue function, but no success.

I will greatly appreciate your quick help and your experienced knowledge.

Hi @Fernando !

I remember answering a similar question here:

Can we build up on the info mentioned in the tattached post?

1 Like

Hi @YuryR ,

Building on the information mentioned in the post, for use case 1, i built a program rule to hide a program stage when the number of visits reaches 7 but it does not work. Is it because we have already entered data for the stage? Also a user can still enter data beyond those visits even though a message is triggered to alert the user.

For use case 2, 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 the condition were met. an error on complete or show error message should be triggered.

Still stuck. Your feedback will be valuable

Thanks