← Back to team overview

dhis2-devs team mailing list archive

Re: Issue with calculation of Age through program indicator

 

Thanks Markus for the response.

Will try again and share the results.

Regards

Saurabh

On 3 Nov 2016 19:16, "Markus Bekken" <markus.bekken@xxxxxxxxx> wrote:

> Hi there Saurabh,
>
> The d2:yearsBetween() is not yet supported in the server side aggregation
> of program indicators. For now you would have to use d2:daysBetween() / 365
> - which is not 100% correct as the leap years is not considered. You wrote
> d2daysBetween in your mail below(without the colon between d2 and
> daysBetween), but i assume that was a typo in the mail.
> If you used the expression *d2:daysBetween(A{yourDateOfBirthAttributeUID},V{event_date})
> / 365* that should work fine on both the server and client side. Let me
> know if this was the expression you tried. Note that the attribute UID
> should be prefixed with A.
>
> In the dev instance the example indicators on the MNCH / PHC program use
> the V{event_date} as basis for the age calculation. This causes the
> indicators to be calculated to NaN until you enter an event date. If you do
> not explicitly want the age at the event, you can use V{enrollment_date}
> instead.
>
> Markus
>
> P.S. The attributes of type date is not shown in the expression part of
> the Program Indicator UI, only in the filter further down. This is all
> getting reworked and sorted out soon, but as a workaround for avoiding
> typos you can add the attribute in the filter part of the UI then
> cut'n'paste.
>
> 18. okt. 2016 kl. 18.11 skrev Saurabh <saurabh.leekha87@xxxxxxxxx>:
>
> Hi Devs
>
> Have been trying to create a program indicator for calculation of Age (in
> years) using the ‘d2yearsBetween’ expression (have tried with
> ‘d2daysBetween’ as well), and then putting the attribute for date of birth,
> and event/current date. The date of birth is not part of the attribute list
> in the ‘Expression’ part of the program indicator, hence the attribute UID
> (for DOB) is used instead in the expression.
>
> Although the expression is shown as valid, but the output is still ‘NaN’.
>
> Similar indicators are available on the dev instance (
> https://play.dhis2.org/dev/) for the MNCH program for Mother’s Age at
> visit in years/days, but there also the value shows as ‘NaN’.
>
> Would appreciate some help around this, if this can be fixed, or we are
> doing something wrong here!
>
> Regards
>
> Saurabh
>
> _______________________________________________
> 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
>
>
>

References