Can't clean or edit submissions in Central; Enketo error with pulldata() and choice_filter

1. What is the issue? Please be detailed.
What could be causing Enketo to fail to load a entity form in Central, while it works in ODK Collect and other similar forms? How can we fix or restructure the logic so Enketo allows data cleaning for our partners?

We're having trouble editing submissions in ODK Central via Enketo. The form was designed to pull a beneficiary's name and ID using entity data (projectXYZ_beneficiaries). It works perfectly during data collection in the ODK Collect app, but fails in Central.

The form has a begin_repeat called part_list, where users select a participant. Inside that repeat, there's a select_one called search_name (autocomplete with search('projectXYZ_beneficiaries')), and a calculate that pulls the ID like this:
if(
pulldata('projectXYZ_beneficiaries', 'ID', 'name_beneficiary', ${search_name}) != '',
pulldata('projectXYZ_beneficiaries', 'ID', 'name_beneficiary', ${search_name}),
pulldata('projectXYZ_beneficiaries', 'ID', 'name_family', ${search_name})
)
Some entities use name_beneficiary (e.g. commercial farmers), others use name_family (e.g. smallholders), depending on how they were registered. The logic works in Collect.

The issue: when opening the submission in Central for editing, Enketo fails to load the form. After clicking "OK" on the error message, the form loads with no fields visible, making cleaning or editing impossible.

This also affects another form that uses similar logic, but strangely that one does allow edits; so it’s unclear what exactly is causing this.

2. What steps can we take to reproduce this issue?
Submit a form via ODK Collect, selecting a name via autocomplete (search_name) and allowing the ID to be pulled using the conditional logic.

Go to ODK Central → Submissions → Edit → try to open the form via Enketo.

Observe the error and empty screen after clicking "OK".

3. What have you tried to fix the issue?
We simplified and restructured the pulldata calculation to isolate errors.

We tested removing the conditional logic: this helped reduce issues but broke the logic we need (since name_family or name_beneficiary can be used depending on the entity).

We suspect that the problem may relate to the choice_filter on another select_multiple question filtering organizations, but we’re unsure how that’s interacting with Enketo.

4. Upload any forms or screenshots you can share publicly below.
FormLogicError: Could not evaluate: if("" != '', pulldata('projextXYZ_beneficiaries', 'ID', 'name_beneficiary', ../search_name ), "20241022M0a01an1995AG"), message: callNative() can't handle nodeset functions yet for pulldata()

Would you mind to share a related extract of your form or a short example, please?

1 Like

What does this if mean, please? Always true() or false()? You might try replacing it for testing.

1 Like

I think the issue is with ../search_name. Either it can sometimes return multiple values or it always returns one value but because Enketo thinks it could return multiple, it's treating it as such. Could you try concat('', ../search_name) instead? That might force Enketo to see a text value there instead. If that doesn't work, another idea is join(" ", ../search_name).

The search() appearance/function is not supported by Enketo so there may be more restructuring needed if you want to be able to do web-based edits.

Can you tell us more about the nature of the edits you need to make? E.g. did you notice an inconsistency when processing data? Did someone call in a change request? Is the data that needs updating also saved to your Entities? How common is this kind of edit?

2 Likes

Thanks for all the suggestions this helped us experiment further and basically when we pulldata from entities we need to keep it simple, instead of creating one single calculation with complex if statements, better to split it in 2.. because this doesn't work in Enketo. thanks for your help

I’m glad you were able to figure out a solution! Could you please share what you ended up going with so we can see if there’s a bug to fix or better documentation to add?

I’m also very interested in learning more about your edit processes and some of the questions I asked above as we consider other edit-related improvements.