← Back to team overview

dhis2-users team mailing list archive

Re: Problem using d2:condition()

 

Hi Ese,

Thank you for your help, you know what I mean.

It works fine.

Hasina



2015-11-03 1:50 GMT+03:00 Ese Egerega <ese@xxxxxxxxxx>:

> Hi Hasina,
>
> Am not sure if this is what you mean but I had an experience where program
> indicators with the d2:condition function always evaluated to "false" when
> displayed in the tracker.
>
> You may want to try using the ternary conditional operator instead:
>
> condition ? if_true : if_false
>
> So your first expression will look like this...
>
> 1 > 0 ? 1 : 0
>
> The result will be 1 since the expression (1 > 0) evaluates to true.
>
> Thanks,
>
> -Ese
> On Oct 30, 2015 1:30 PM, "ramaso hasina" <hasina.ramaso@xxxxxxxxx> wrote:
>
>> Hi all,
>>
>> I've created a program with some program stages.
>> When I create a program indicator using the function d2:condition,
>> the result is not what I'm expected.
>>
>> Example in the expression field :
>>   - d2:condition('1 > 0',1,0) => result "false".
>>   - d2:condition('#{w7N4mScR2g6.Sv4bRYIiSHy} == true',1,0) => result
>> "false" (#{w7N4mScR2g6.Sv4bRYIiSHy} having a "true" value)
>>
>> Need help.
>>
>> Thanks.
>>
>> Hasina.
>>
>> _______________________________________________
>> 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
>>
>

References