Using JEXL in program indicator expressions

Program Indicators With JEXL

In the dhis2 user manual for 2.29 it’s mentioned that the functionality of program indicators (& filters) can be expanded using JEXL. However when I test even the most basic of JEXL functions in a program indicator it just returns the text I put into the expression in the TEI dashboard.

For example on play (2.29) I create a new program indicator with simple JEXL expression:

size("Hello") // Should return 5

In the TEI dashboard I get this:

Is there some special formatting or extra step I am missing here to get this working? There seems to be a lack of good examples available online which is why I’m asking here.

Many thanks for your time,

1 Like

Hey there @plinnegan - thank you for pointing this out.
I am afraid this is an error in the docs, we do not support JEXL functions. The program indicator functions are transformed to SQL, and only the functions in the table “Functions to use in a program indicator expression or filter” are suppoerted.

We will update the docs.

Adding a new function for doing what you ask for makes perfect sense. Feel free to add a jira feature request for a d2:length() function.

Best regards

1 Like