Predictor expression

Hi,
I am trying to create a predictor expression. I want to create an expression that returns 1 if the condition true. if deliveries greater than 50 and the organization unit name contains “DH”.

if(“DH”=~V{org_unit_name} and #{a8uLGfI8qPC}>=50,1,0)

the error was “Expression is not well-formed”

Please help to correct this expression.

Thanks.

Try:
d2:condition('~V{org_unit_name} == "DH" and #{a8uLGfI8qPC} >= 50',1,0)

@devpatankar and @SDKAAA,

@Jim_Grace may be able to help here, but I do not think that V{org_unit_name} is a valid variable in predictors.

1 Like

Hi @devpatankar, @Scott is right, the variables V{…} are for program indicators, not predictors. Something you could try is you could create a program indicator that uses this function, and returns, for example, a 1 if the orgUnit contains a “DH”, else 0. Then you can reference this program indicator inside the predictor expression. I haven’t tried this kind of thing myself, but I’ve heard from someone else that it can work.

1 Like

Hi Jim, That’s quite clever!

How i wish these could be standardised across all parts of DHIS2 :smile: