Problems with using dynamic select_one from within a nested repeat

1. What is the problem? Be very detailed.

Hi ODK community!

I am using the "select-one-from-repeats" feature that was described here in order to offer a dynamic options list based on a previous repeated field. However, the select_one is placed within a repeat-in-repeat itself, and that seems to cause some trigger/refresh issues. I've compiled a little minimal showcase below. Find the XLSForm attached.
odk_repeat_bug.xlsx (10.6 KB)

This is more about Enketo, haven't tested with Collect.

The example is about surveying people and their homes where each person can actually belong to multiple homes and each home can also have multiple people in it - basically an m:n releationship.

Page 1: Using a repeat, list all names of people that you want to collect.

Page 2: Using a repeat, list all names of the homes that people live in.

Page 3: Here comes the allocation. The outer repeat lists all homes again, this technique is documented here. Within that repeat, there is another repeat that allows to dynamically allocate people to each home. That inner repeat has a select_one field that is dynamically populated with peoples' names that were entered on page 1.

As you can see in the screenshot below, there seems to be an issue with updating the select_one options when the repeat entities get created (the first repeat of Home nr. 1 only has one option, for Home nr. 2 it's all options). My expectation: the select_one options should be refreshed/updated in a way that they are always up-to-date with the repeat that they originate from.

2. What app or server are you using and on what device and operating system? Include version numbers.
ODK Central 1.3.3
Enketo 3.0.4

3. What you have you tried to fix the problem?

I played around with placing true() for the trigger of some fields.

A current workaround is to manually remove the inner-repeat item with the "-" button and re-add one with the "+" button. Then all options appear.

4. What steps can we take to reproduce the problem?

See above.

5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.

Honestly, the fact that this complex m:n use case is possible with this toolset already is quite incredible. Cheers for that!

1 Like

Just wanted to note that I meanwhile also filed an issue for enketo-core: https://github.com/enketo/enketo-core/issues/847