Defaults not showing on ODK Collect

Hello again,

Defaults are not showing up as 0 when using ODK collect, which messes up the interpretation of inputs which rely on three inputs e.g.

question 1 = 0 (must be entered by user)
question 2 = 0 (default to 0 as not relevant if ans to question 1 = 0)
question 3 = 0 (default to 0 as not relevant if ans to question 1 = 0)

0 + 0 + 0 = normal appearance

However on ODK it just appears as

question 1 = 0
question 2 =
question 3 =

And ODK Collect does not show normal appearance on the form.

On Enketo it is working perfectly:

Is this bug that could be fixed on ODK collect?

Many thanks!

Can you attach the XLSForm you are using?

Hi yes I have attached here.

Many thanks for looking at this for me!
Hepatic_ultrasound_resultsv2.xlsx (15.8 KB)

You have a default is 0 on a calculate type question. I believe that this will always be overridden by the calculation. On line 37, it will always try to calculate ${int_pt} + 1 if those questions are relevant and if it cannot, it will throw an error, it will not use the default value you've supplied.

When testing your form, if I answer "1" for "Liver 1: Parenchyma Pattern" and "yes" to "Liver 2: Periportal thickening" then you can see that those sections become relevant, and the calculations are done, and because there are missing values (no answers to use for pieces of the calculations) then you get a NAN error which means "not a number".

Can you make all your questions required and use relevant checks to hide questions as needed? Then, when the user gets to the end of the survey, there shouldn't be any missing values for calculations.

Hi Dan,

Thanks so much for your reply. Sorry I am in the field so didn't manage to get back to you.

So the other calculations later on in the form are only relevant if the Pattern Score is more than or equal to 1. If the Pattern Score is 0 (Normal liver) then the other calculations do not apply as there should not be any periportal thickening or increased portal vein diameter.

Is there a way to show an interpretation at the end of the form if nothing has been filled in for the other calculations?

Many thanks again

I think you should be able to split the information across multiple notes and use relevant to show/ hide the different notes depending on if the information is available.