Calculate failing to Add variables when some variables are empty

When i use the calculate to add a list of variables such that one variable is empty, the results doesn't show. e.g. if i want to add to variables say, ${q1} + ${q2} and q2 is empty, the final result was not showing. This normally happen when a question is skipped such that it is blank. As a solution i tried to make the question a compulsory so that if the respondent doesn't know the answer should just type zero in order to avoid creating blank spaces. I was using ODK collect version 1.4.10. I am using android version 4.4.4 on a Samsung galaxy tab. That's the problem am having. If it is already fixed let me know.

Hi @Vincent_Mkandawire,

Try replacing each variable in the calculation by a if condition if(variable x>=0, variable x, 0). Note that I suppose your variables are positive numerals.


@Souirji That may be another solution. Although assuming you have many variables in the calculation you may need a complex formula to do that.

In that case, you store the result of that complex formula in another calculate and then do the if condition on the result.