What does an irrelevant question evaluate to in CommCare

commcare

Let's say I have a form with a calculation condition that references another question in the form. For example:

if (#form/question_1, 'yes', 'no')

What does this evaluate to in the case that question_1 is hidden entirely via a display condition? I assume this would be false and not, e.g. a reference error?

Best Answer

If question_1 is irrelevant, but the question exists in the form, references to the question will evaluate to an empty value (ie: '') and should not cause errors.

References to the element's node in XML will return an empty set. IE: count(#form/question_1) will return 0.