I’m trying to build an indicator where I need to count how many times a specific value (let’s say x) has been selected.
The problem is that the Data Element is of type multi-text. This means that when users select multiple options, the stored value looks something like this in the JSON:
Data Element = a, b, x
Because of this, a simple comparison like Data Element = x doesn’t work if more than one value is selected.
Has anyone faced this issue before? Is there a way to design an indicator that can handle multi-text values like this in DHIS2 2.41.1?
Any ideas or workarounds would be greatly appreciated.
Thanks for sharing that you are using version 2.41 because in that version you can actually use the contains() and containsItems() expressions in the Indicator. The indicator expression will be something similar to if(contains(theDataElement,'x'),1,0)
I have some multitext data elements in my program. Let’s say we have [‘a’,’b’,’c’,’d’] as options, how can i built a program indicator that counts how many times ‘a’ has been selected?