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 <[email protected]>:
>
> 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/ <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
> <https://launchpad.net/~dhis2-devs>
> Post to : [email protected]
> <mailto:[email protected]>
> Unsubscribe : https://launchpad.net/~dhis2-devs
> <https://launchpad.net/~dhis2-devs>
> More help : https://help.launchpad.net/ListHelp
> <https://help.launchpad.net/ListHelp>
_______________________________________________
Mailing list: https://launchpad.net/~dhis2-users
Post to : [email protected]
Unsubscribe : https://launchpad.net/~dhis2-users
More help : https://help.launchpad.net/ListHelp