← Back to team overview

dhis2-users team mailing list archive

Re: Program indicator expressions

 

Hi Markus,
DHIS V2.28, Database:Postgresql

I tried like this too but i saw error in browser console and result display
"false". like below:




On Thu, Apr 12, 2018 at 5:34 PM, Markus Bekken <markus@xxxxxxxxx> wrote:

> the below expression should work, yes :)
>
>
> 12. apr. 2018 kl. 11:13 skrev Jane Greig <jane.greig@xxxxxxxxxxxxxx>:
>
> So numeric would solve it for us?
> That is, if the code for the option we want is numeric = 2 in all 3 data
> elements, this should work?:
> d2:condition('#{qaDVwQUHD0j.g4bPEQ4a7WM} == 2 ',1,0) +
> d2:condition('#{qaDVwQUHD0j.FFpJ2FZU7rJ} == 2 ',1,0) +
> d2:condition('#{qaDVwQUHD0j.dLKjtfo7GD3} == 2 ',1,0)
>
>
> *From:* Markus Bekken [mailto:markus@xxxxxxxxx <markus@xxxxxxxxx>]
> *Sent:* 12 April 2018 19:09
> *To:* Jane Greig <jane.greig@xxxxxxxxxxxxxx>
> *Cc:* dhis2-users@xxxxxxxxxxxxxxxxxxx
> *Subject:* Re: [Dhis2-users] Program indicator expressions
>
> Ok, I understand - was fearing this could be the reason :) The codes need
> to be quoted when they are text-based, so the other short-term workaround I
> can think of is to use numeric codes.
>
> Markus
>
>
> 12. apr. 2018 kl. 11:06 skrev Jane Greig <jane.greig@xxxxxxxxxxxxxx>:
>
> HI Markus
> Thanks for your response. I thought that might be the problem.
> Unfortunately our use case is more complex than my example, so the filter
> workaround doesn’t help – we want the indicator to return a combined set of
> conditions. For example, 3 data elements all with the same option set for
> delivery of up to 3 babies for a pregnancy, to count not the event once,
> but 0, 1, 2 or 3 live births (option ‘LB’) from the 3 data elements for
> baby outcome. It sounds like we will have to make numerous program
> indicators using filters, and then aggregate indicators to combine them. We
> were trying to avoid that!
> Thanks
> Jane
>
>
> *From:* Markus Bekken [mailto:markus@xxxxxxxxx <markus@xxxxxxxxx>]
> *Sent:* 12 April 2018 19:02
> *To:* Jane Greig <jane.greig@xxxxxxxxxxxxxx>
> *Cc:* dhis2-users@xxxxxxxxxxxxxxxxxxx
> *Subject:* Re: [Dhis2-users] Program indicator expressions
>
> Hi there Jane!
> The problem with the below condition is that we are using single quotes
> inside a single quoted statement. This is not supported at the moment.
>
> Not really knowing enough about the use case, I venture into suggeting a
> possible workaround: If you are able to use the condition below as a filter
> statement instead of an expression, you can change the aggregation type to
> "Count", and the expression to "V{event_count}".
>
> Markus
>
>
>
> 10. apr. 2018 kl. 08:09 skrev Jane Greig <jane.greig@xxxxxxxxxxxxxx>:
>
> Hi
> Can anyone advise on whether program indicator expressions can use data
> elements with option sets? They do not appear in the list of data elements
> available, but it does not tell me my expression using the UID of one is
> invalid. However, it also does not give me a result. Example I am trying to
> use is:
> d2:condition('#{qaDVwQUHD0j.g4bPEQ4a7WM} == 'LB' ',1,0)
> to return a value of 1 if that condition is true, otherwise 0. Is that
> possible and I am just writing my expression wrongly? Even with a Boolean
> data element that does appear in the list of data elements, I could not get
> a result using == 1, == TRUE, == Yes.
> Any guidance is appreciated.
> Thanks
> Jane
>
> ________________
> Jane Greig, PhD
> Epidemiologist MSF-OCA
> Manson Unit, MSF-UK
>
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>
>

PNG image


Follow ups

References