Hi Lars,

Many thanks, that’s great to know – it makes handling Yes/No data types in 
indicators very easy!  ☺

Apologies, I’ve checked that “bug” again, and noticed I’d actually changed 
those data elements from my own custom Yes/No (ie an option set with Integer 
codes) to the native Yes/No – so it was possibly legacy data that had been 
saved before the datatype change that was showing up in the UI.  (That data’s 
unfortunately now been over-written, so I can’t be sure.)  For now, assume 
there’s no UI bug – I’ll let you know if I come across anything.

Many thanks again,

Sam.

From: Lars Helge Øverland <[email protected]>
Date: Wednesday, 2 November 2016 at 12:20
To: Sam Johnson <[email protected]>
Cc: DHIS2 Developers <[email protected]>
Subject: Re: [Dhis2-devs] Confirming 'official' handling of Yes and No in 
program indicators

Hi Sam,

On Mon, Oct 31, 2016 at 10:51 AM, Sam Johnson 
<[email protected]<mailto:[email protected]>> wrote:
Hi Devs,

I’ve been working on some quite complex program indicators, and before I commit 
them to production, I would be very grateful if you could confirm how Yes and 
No are supposed to be handled in program indicator expressions.

I’ve noticed that within the program indicators, they currently resolve as 
Yes=1, No=0 and non-response=null.  So for example:

•         Putting the data element ‘YesNoDE’ itself into an Event Report 
displays: Yes

•         Creating an indicator containing #{YesNoDE} displays: 1

•         You can do complex indicators involving the Yes/No data element, eg 
an index calculation:
1.2345 + #{YesNoDE_A}*2.3456+#{YesNoDE_B}*0.7654.

•         You can even put these complex calculations within a d2:condition, eg 
to test thresholds:
d2:condition('1.2345 + #{YesNoDEa}*2.3456+#{YesNoDEb}*0.7654>3.1',1,0)

This is all excellent, as it enables us to do all sorts of powerful 
calculations/conditions with Yes/No responses interpreted as 1 or 0.  ☺

So my question: is this expected behaviour, and will it remain consistent in 
future versions of DHIS2?  I’ve noticed, for example, that there are some 
rendering bugs in Event Capture, where ‘No’ appears as ‘0’ etc – is there any 
chance that the handling above will be broken when those bugs are fixed, or 
will I be able to continue to rely on it?

Yes, it is expected, and will be continued.

To elaborate: In the trackedentity datavalue table we store boolean values as 
true | false. We convert this to 0 | 1 when we generate the analytics tables to 
make it more suited for aggregation (as you point out above).

Re the event capture bug - please report with a bit more context and we will 
try to fix - it is strange that it shows up as 0.

best regards,

Lars




Cheers, Sam.


_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : 
[email protected]<mailto:[email protected]>
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
[email protected]<mailto:[email protected]>
http://www.dhis2.org<https://www.dhis2.org/>

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to