Could not cast Boolean 'false' to Double

Hi everyone,

I know that for a yes/no data element, the database saves 1 for yes and 0 for No, so why summing two data elements of yes/no data type gives the following error in the program indicator expression: Could not cast Boolean ‘false’ to Double.

Thanks

Hi @fernandoshake

I tried to reproduce this issue but using a Yes/No in the expression as well as the filter for a program indicator was working fine. Would you please provide the steps to reproduce this issue on play.dhis2.org? The creation of the data element as well as the program indicator.

Thank you!

Hi @Gassim,

The DHIS 2 version i am using is 2.37, but when I tried to build the same program expression in demo 2.38, it shows no error. Does it have to do with the DHIS 2 version?

Thanks

1 Like

It could be cache issue as well. If we can’t reproduce it in the same version 2.37 for example then it’s probably not a bug but if it can be reproduced then there’s a chance it’s a bug or a configuration issue which means we then nee to triage to the core team. Sometimes a bug is fixed for a higher version and then needs to be back ported to the previous versions.

Other core team members are looking into the issue mentioned above and will get back to you as soon as there’s an update.

Thank you!

This is a bug - I created a jira: [DHIS2-13722] - Jira

1 Like

Please note that this will cause issues if you are planning to use Android as the App will never cast Boolean to Integer/Float. A workaround consists on creating another ProgramRule(s) where a ProgramRuleVariable is assigned 1 or 0 depeneding on the value of the Boolean. This is explained in the doc and an example was provided here: Program rule, assign value by summing boolean data elements - #4 by jaime.bosque

1 Like