I am creating some Program Indicators for a project I am working on and I have found the need to use a d2 function in the filter.
I keep getting an invalid expression however, even if it’s just the d2 function (I am checking on the length of a data element as part of the program stage).
function looks something like this → d2:length(#{d3msCrtGnoq.JQcJNEe9nav}) > 3
Any idea why this wouldn’t be recognised as a valid expression?
It happened to me in the past that I got invalid expression, but the program indicator worked, so it is worth saving the expression and checking if you are getting the expected result. On the other hand:
d2:length(text) → Find the length of a string.
Example:
d2:length(#{variableWithText})
I think you are not using it in the proper way. Could you please explain what your indicator needs to measure?
I am trying to report the number of events that have a viral result higher than 1000.
Unfortunately the data element I am filtering on is a text field so I thought I would be able to exclude all the known text values and then also filter on the string length > 3 (1000 would equate to a string length of 4).
A pared down example of what I am doing is this:
#{d3msCrtGnoq.JQcJNEe9nav} != ‘Target Not Detected’ && d2:length( #{d3msCrtGnoq.JQcJNEe9nav}) > 3
Just thinking out aloud as it seems as though d2:length is not available at the filter level of the Program indicator.
What I am thinking now is can I create a Program rule that can do some evaluation as this stage event is created so I can populate another data element with an integer value?
The one caveat is that this stage is being populated via the API.