Indicator with multi-text values (DHIS2 2.41.1)

Hi everyone,

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 in advance!

Hi @Henry_Lopez18

Welcome to the DHIS2 Community!

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)

You can read more about this in the ticket here: Jira

Please feel free to continue to share the progress you make and if you’re getting the result you’re looking for.

Thanks!

Hello community

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?

Thanks so much for your support

William

Hi team,

Just found a solution using contains. Flagging as solved.

Thanks

Hi @waviles

Thanks for letting us know! Glad it helped. :folded_hands: