dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #45881
Re: Program indicators - nested d2:condition()?
Olav,
I have not tried it, how about using brackets? e.g
d2:condition(x1,(d2:condition(x2,(d2:condition(x3,x3true,x3false),x2false),x1false)
I am not sure if the brackets are supported but it will keep it in the same
format.
Alex
On Fri, Jul 8, 2016 at 1:55 PM, Olav Poppe <olav.poppe@xxxxxx> wrote:
> 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)
> )
> )
> )
> )
> )
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help : https://help.launchpad.net/ListHelp
>
>
--
Alex Tumwesigye
Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET | HISP Uganda
Kampala
Uganda
+256 774149 775, + 256 759 800161
Skype ID: talexie
IT Consultant (Servers, Networks and Security, Health Information Systems -
DHIS2, Disease Outbreak & Surveillance Systems) & Solar Consultant
"I don't want to be anything other than what I have been - one tree hill "
Follow ups
References