Error with results of data

HI dear,
please I need your kind support,
We developed a scoring calculation manner based on specific criteria, on one form and test it before starting the data collection process, then when we finish and download it, we find some cases with scores and cases with “NaN”.
Please what this means, and how we can solve it in our raw data?

many thanks,

Hi @eliasandraws, welcome back to the community!

In the ODK Form Logic, unanswered number questions are nil. That is, they have no value. When a variable referencing an empty value is used in a math operator or function, it is treated as Not a Number (NaN). The empty value will not be converted to zero. The result of a calculation including NaN will also be NaN, which may not be the behavior you want or expect.

To convert empty values to zero, you can use either the coalesce() function or the if() function.

coalesce(${potentially_empty_value}, 0)
if(${potentially_empty_value}="", 0, ${potentially_empty_value})

So in your case, you need to check your math operators in your calculate questions.

Please let us know if you need further help.



Many thanks for your very useful answer,
can I solve it if I modify the logic on KoBo?

@eliasandraws, Yes indeed, you need to look at your calculate questions.

If you can share your form in xls format, I can take a quick look into it.