What is the problem? Please be detailed!
In an XlsForm, we have a calculate
called selected_female_name
. It has a relevant
set to (${roster_complete} = 'yes')
. Its value is indexed-repeat(${firstname}, ${hh_rpt}, ${randpos})
.
There is a household roster in the form which is a repeat group hh_rpt
. roster_complete
is a select_one
question that comes after the repeat group ends, and the respondent verifies by selecting from a 'yes' or 'no'.
The issue is occurring at times during the roster. Clearly, the roster is not complete yet, so the question roster_complete
has not yet been asked. Therefore we expect its value to be empty, thus falsy. If it is in fact falsy, then we expect the relevant on the selected_female_name
calculate to evaluate to false, and the calculate to also be empty, thus falsy. However we get the following error.
What ODK tool and version are you using? And on what device and operating system version?
ODK Collect (can check later for version if needed) on Android 6.
What steps can we take to reproduce the problem?
The form has been uploaded here: https://drive.google.com/open?id=0ByFhlRDkSVPoYjVfbmJMR2pqZ3M
The form is rather short, and the error is not very far into the form.
What you have you tried to fix the problem?
We changed the value of selected_female_name
from indexed-repeat(${firstname}, ${hh_rpt}, ${randpos})
to if((${roster_complete} = 'yes') and (${randpos} != ''), indexed-repeat(${firstname}, ${hh_rpt}, ${randpos}), '')
.
This has fixed the problem for us in the form of a workaround. However I am wondering if it is a bug in ODK that relevants on calculates are not firing correctly? It does not seem to make sense to me that we would need to wrap this logic in an if statement in addition to a relevant.