dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #45880
Program indicators - nested d2:condition()?
Hi devs,
I’m trying to set up a program indicator that counts events within age groups. Age is collected with two different methods:
- Date of birth and date of death
- Estimated age (when DoB is not available), using one «periodtype» field and one «period count» field, e.g. 4 and Months in two different data elements.
Based on this, I wanted to calculated a few indicators, including «age in years» for individual events, and counting number of events by age groups (0-4 years etc). I figured I could do this by having multiple d2:condition() functions (see below), but that gives «Illegal arguments, expected 3 arguments: condition, true-value, false-value». Can someone confirm whether or not nesting d2:condition() is supported or not, and advice on alternative approaches?
Regards
Olav
d2:condition(#{wmSb9TmevMn.UoL9vGPT0qF} is not null,
d2:daysBetween(#{wmSb9TmevMn.UoL9vGPT0qF},V{execution_date}) < 1825,
d2:condition(#{wmSb9TmevMn.FlzVuMSdC2F} == 'YEARS',
#{wmSb9TmevMn.Zp1elSUYpwI} < 5,
d2:condition(#{wmSb9TmevMn.FlzVuMSdC2F} == 'MONTHS',
#{wmSb9TmevMn.Zp1elSUYpwI} < 60
d2:condition(#{wmSb9TmevMn.FlzVuMSdC2F} == 'WEEKS',
#{wmSb9TmevMn.Zp1elSUYpwI} < 260,
d2:condition(#{wmSb9TmevMn.FlzVuMSdC2F} == 'DAYS',
#{wmSb9TmevMn.Zp1elSUYpwI} < 1825,
d2:condition(#{wmSb9TmevMn.FlzVuMSdC2F} == 'DAYS',
#{wmSb9TmevMn.Zp1elSUYpwI} < 43800,
false)
)
)
)
)
)
Follow ups