← Back to team overview

dhis2-devs team mailing list archive

Re: Program indicators - "datediff", custom forms ++

 

Hi Olav,

On Mon, Sep 21, 2015 at 4:30 PM, Olav Poppe <olav.poppe@xxxxxx> wrote:

> Hi, the new program indicators are great, but I have a couple of
> questions/requests.
>
> First of all, it does not look like it is possible to add them to custom
> forms currently (and I didn't find a blueprint for it). Would be great if
> that could be supported.
>

Yes agree, we should add this.

>
> Secondly, it would be great with some basic "date calculations",
> essentially to get the number of days/years between two dates. As far as I
> can see this is not possible currently with program indicators.  I think
> this would also be very useful for the program rules, e.g. you have two
> dates and would like to enable/disabled fields or sections based on the
> different between them. In my particular case, I'm looking at cause of
> death registration and would like certain fields to be active only if the
> age is < 1 year based on date of birth and death.
>
>
That is possible in trunk, see docs for the d2:daysBetween function:

https://www.dhis2.org/doc/snapshot/en/user/html/ch30s03.html


FunctionArgumentsDescriptiond2:daysBetween(date, date)Produces the number
of days between two data elements/attributes of type date. The static date
format is 'yyyy-MM-dd'.

 An example expression that uses the "daysBetween" function looks like this:

d2:daysBetween(#{mCXR7u4kNBW.k8ja2Aif1Ae},'2015-06-01')


regards,

Lars




> Regards,
> Olav
> _______________________________________________
> 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
>



-- 
Lars Helge Øverland
Lead developer, DHIS 2
University of Oslo
Skype: larshelgeoverland
http://www.dhis2.org <https://www.dhis2.org>

Follow ups

References