# Instance lookups on internal choices / Instance logic order with Enketo

**URL:** <https://forum.getodk.org/t/instance-lookups-on-internal-choices-instance-logic-order-with-enketo/42636>\
**Category:** Support\
**Tags:** enketo, odk-central, odk-collect\
**Created:** [August 12, 2023, 11:49am UTC](https://forum.getodk.org/t/instance-lookups-on-internal-choices-instance-logic-order-with-enketo/42636 "2023-08-12T11:49:52Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![ahblake](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ahblake/32/22392_2.png) [@ahblake](https://forum.getodk.org/u/ahblake)\
**Post date:** [September 16, 2024, 6:33am UTC](https://forum.getodk.org/t/instance-lookups-on-internal-choices-instance-logic-order-with-enketo/42636/13 "2024-09-16T06:33:50Z")

</div>

> [@ahblake](#):
>
> When using an instance lookup with filters beyond just one/many _value = ${field}_ statements, the order of the value and field matters to Enketo

@LN related to this (and maybe to [this](https://forum.getodk.org/t/enketo-form-load-error-with-instance-lookup-in-choice-filter-cannot-read-properties-of-undefined-reading-length/43557/9)), a choice filter that has a basic filter and an instance filter will upload with no validation errors, but the order of the basic filter can result in a form load error in Enketo.

# No validation errors, but will throw a form load error in Enketo:

`${town}=town and contains(join(' ',instance('submissions')/root/item[street=${street}]/module),name)`

## Error message:

> FormLogicError: Could not evaluate: /model/instance[@id="ref\_list"]/root/item[/model/instance[1]/data/grp\_start/town =town and contains(join(' ',/model/instance[@id="submissions"]/root/item[street= /model/instance[1]/data/grp\_start/street ]/module),name)], message: callNative() can't handle nodeset functions yet for townandcontains()

# No validation errors, no form load error in Enketo, note the order of first filter is reversed.

`town= ${town} and contains(join(' ',instance('submissions')/root/item[street=${street}]/module),name)`

---

_[View the full topic](https://forum.getodk.org/t/instance-lookups-on-internal-choices-instance-logic-order-with-enketo/42636)._
