![]()
@LN I hit this one again, but no instance lookup in the choice filter and this time reading 'toString'. Form again validated, but threw an error when loading in Enketo. Form did load, but was broken with the affected fields and fields unrelated to it having issues.
Error occured during the loading of this form. We do not recommend you use this form for data entry until this is resolved.
Please contact support@getodk.org with the link to this page and the error message below:
FormLogicError: Could not evaluate: /model/instance[@id="ref_list"]/root/item[if( /model/instance[1]/data/grp_start/filter_preexisting !='',level= /model/instance[1]/data/grp_start/level and contains( /model/instance[1]/data/grp_start/filter_preexisting ,category), level= /model/instance[1]/data/grp_start/level ) and if( /model/instance[1]/data/grp_start/record_type ='report',category!='A',category='A')], message: Cannot read properties of undefined (reading 'toString')
previously working:
if(${filter_preexisting}!='',level=${level} and contains(${filter_preexisting},category), level=${level})`
caused error:
if(${filter_preexisting}!='',level=${level} and contains(${filter_preexisting},category) and if(${record_type}='report',category!='A',category='A') , level=${level}) and if(${record_type}='report',category!='A',category='A')
I've since reworked the logic to this and it doesn't throw any errors and appears to function correctly with no load errors in Enketo.
if(${record_type}='report',level=${level} and category='A',if(${filter_preexisting}!='',level=${level} and contains(${filter_preexisting},category), level=${level} and category!='A'))
And to rub salt into the wound I hit the dynamic read-only Enketo bug after!