Information display

Hi all,

We have built a mentorship tracker program – to be used on android phones - which consists of 11 program stages (each program stage is a checklist of Yes/No questions). For each checklist, we have built program indicators to calculate a score in percentage. The scores are calculated well, but there is one issue: users can see the percentage score after filling each checklist, but we also would like them to see procedure competency displayed on a label. It is a requirement to display competency for the users entering data on the phones so that an action plan can be taken.

To sum, each health provider is assigned a competency for each Procedure Checklist. This competency is based on the overall percentage score for the checklist. Below is the information (highlighted) we want to display on a label based on the score obtained:

Total score is >= 80%: Competency = Competent

Total score is >= 50%: Competency = Competent, but Needs Improvement

Total score is < 50%: Competency = Not Competent

Please advise us on all possible means to achieve this.

Looking forward to help


Hi @ferdinandmussavene

Thank you for your question. I will provide two ideas I came up with but their success will depend on how you have configured the program (scores formulas, workflows, analytics, etc.).

  1. Nested “If” function (Program indicator)

Let say you are calculating your score like the screenshot below

Then the nested “if” could be constructed like this

Android will render the labels according to the score

  • If your formula contains too many data elements then maybe this is not the best solution
  • Web will not render the indicator value correctly. Only works in Android.

2. Program rules
If possible, you could calculate your score using program rules and assigning them to a calculated value or even to a new DE called “Score”. Based on that you could add another DE called “Classification or Competency” and again with program rules assign the values “Competent, Needs improvement, not competent”.

This implies you need to create a section to store the new values (% and competency)

I’m attaching the program I used, you can import it in DHIS 2 Demo - Sierra Leone to test it out.
Example.json (40.7 KB)

Let us know if you have any other question


Hi @nancyesp

We are happy with your detailed ideas. we tried to replicate the second step (program rules) before the first step (Nested ifs), but we got stuck. In the example you have given, all the three data elements (xx Question 1, xx Question 2 and xx Question 3 are attached to an option set of number data type with options (Yes/No) and codes (1/0), so it is possible to sum the data elements and divide them by three and get the score.
In our case, the data elements are of Yes/No data type, I mean there is no option set set attached to them and when want to assign the score to Score S1 data element, we got the following error: I have also done this in demo by creating 3 DEs ( P1, P2 and P3) and assigning them to a program stage

Verifying the DEs have values

Error message

We haven’t tried the first step yet. The largest number of data elements is thirty three (33) in one of the checklist The rest of the checklists have less than 33 DEs

Thanks and looking forward to more inputs

Other information
All stages are repeatable as a health provider can be mentored several times in each checklist

The following is the output we want to get in the visualization app

Number of health providers who have been mentored at least once

Number of health providers who have never been mentored

Number of health providers who are competent per checklist

Number of health providers who are not competent per checklist

Number of health providers who are competent, but need improvement per checklist

Hi @ferdinandmussavene . In order to achieve this you will probably have to pass by auxiliary Program Rule Variable that get translated from “Boolean” to “Integer”.

This posts explains it with examples: Program rule, assign value by summing boolean data elements

Hi @jaime.bosque

After having looked at the post above, I think the formula would be incredibly complex for program stages which have many data elements because I would have to create all possible program rule variables and Program Rules for each data element. or maybe to make things less complex I had to change the DEs value type to a number and attach an option set to them like below.


Hi @nancyesp

I imported the JSON file to DHIS 2 demo to see the first idea you suggested, but I see the following error:


Yes, unfortunately if you are planning to use it in Android so far the only way is converting the “Booleans” to “Integers” and this needs to be done either manually via program rule variables (which might end up creating a lot of them and a lot of program rules) and or changing the form source as you are suggesting.

Hi @nancyesp ,

It seems that some program rules are not triggered immediately. Look at the example:

  1. I filled the three questions and the score is less than 50, so the competency is not competent, which is okay.

  2. When I change the answer of Question 2 to Yes, the score changes immediately, but the competency remains the same, I mean not competent while it should change to competent, but needs improvement

Is this a problem in the backend mechanism?


AFAIK the program rules are triggered whenever the Data Element that you have changed losses the focus. But I am not 100% sure and probably @Gassim can invoke the right person to answer this. :slight_smile:

1 Like

Hi @ferdinandmussavene

Another possible solution using Yes/No value types is to use the function d2:CountIfValue. It should look something like this:

About the error with the assignment. Maybe you could open a jira ticket.

Thank you!!

Let me know how it goes.

Example 2.0.json (55.1 KB)


Hi @nancyesp and @jaime.bosque

We were able to create the indicators, but other issues have risen when it comes to visualization: as each program stage/ checklist is repeatable (many events can be created for the same entity), we are unable to view different percentages an individual obtained over time in the event report. In the Mentorship example program you have shared, we replicated what we have done in our DHIS 2 instance in the demo. We registered an individual who was mentored three times in different dates and obtained the following percentages: first event 66.66 %, second event 100 %, and third event 33.33 %, so we hoped to see in a line list all three percentages obtained per entity.

The event report does not return anything.

Note: We want to retrieve and view individual percentages (per tracked entity) across all events in a repeatable stage

Thanks for your help so far