Dynamic choice list

1. What is the problem? Be very detailed.
I would like to collect social network data where someone names up to 10 individuals (in a loop) who they go to for health advice. Instead of then asking a series of questions for each individual, I would like to ask a series of questions where the respondent could choose from a list of those people named. ie. Which of those people do you work with? And then select from a list of 10 names. Is there any way to do this? It will be faster and allow me to establish ties between people named (i.e. Which of those people does person A also know?)

2. What app or server are you using and on what device and operating system? Include version numbers.
ODK collect on a Tablet.

3. What you have you tried to fix the problem?
N/A

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

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

Hey @Jenny_Smith! I'm not sure I full understand what you're trying to achieve. Do you want a respondent to ask someone to name up to 10 people and then have them answer a series of questions on just a few of those people (the same questions for each person)?

If that's not it could you maybe post an example set of questions and a potentially a step by step description of how you see the form?

Hi @Jenny_Smith

Yes, it should be possible to do this.
A possible workflow is the following:

  1. Collect names of up to N individuals (in a loop), using a repeat group
  2. Outside the loop, use calculate field to refer to the individuals listed
  3. Create a list referencing the people used in the calculate fields at step 2)
  4. Use select_multiple questions with the list created at step 3)

Please find sample form attached test_jenny.xlsx (48.1 KB) .

Note that:

  • I've included in the example a max number of people that can be registered (because of step2)
  • If you have a set number of people to be listed you can use the repeat_count field
  • Otherwise you can have an error message like the one at row 8 (error).

I hope this helps!

Best,
Andrea

3 Likes

Brilliant - yes! This is exactly what I was hoping for. Thank you so much!

Jenny

2 Likes

Hi Andrea,

Wondering if you can take a look at the attached form - essentially the same as yours but when I run it in Enketo the choice labels are not appearing in the list (but yours do). I have done some checks and the individual variables are calculating correctly (ie I can reference them and works fine). So I think it is something about the way the list is constructed. I am not sure why it would differ from yours though.
SNA_test_simple.xls (56 KB)
Thank you,
Jenny

Hi @Jenny_Smith

It looks like there might be a bug when using the repeat_count (enketo1).


After entering the groups, the variables are not displayed in the multiple choice (in the screenshot below example with 3 groups entered)

After a few tests, I've tried removing it (cell H5) and it works fine (enketo2).
I'm not sure why this is the case.

I have also noticed another small issue on Enketo:
the number of boxes is correct, but the last label is not displaying. Example when entering 3 people, only the first 2 names appear in the multiple choice, with the 3 box having no label. I guess it is a bug as one enters an additional group, the label is correctly visualized and an "empty" cell is added.

CC'ing @martijnr, in case he can kindly advice.

If urgent, in the meanwhile you can try using the workaround I had designed in the previous form (with the error message).

I hope this helps!

Best,
Andrea

P.S.
The validation of your form throws a warning on the language.


To fix it, you might want to follow the indications at

and add "(en)" to the column name

1 Like

Hi Andrea,

Huge thanks for the quick response, that is very helpful. I had noticed those issues with the last repeat not appearing on the list.......that could be a problem.

I am setting up a tablet to test in ODK collect, I assume I will run into the same issues there? Unfortunately it is pretty urgent, so I may have to go for a workaround.

Thanks again!

Jenny

Thanks @Jenny_Smith and @Andrea_Martin!

I didn't look into this in great detail but there is something odd about the XForm. It includes ${..} references. It looks like these are from the name column in the choices sheet which cannot be dynamic. I think that explains the issues you are seeing. We may have to add a helpful warning to XLSForm for that.

If you believe there is a bug in Enketo after all, please let us know (also feel free to just directly open an issue here: https://github.com/enketo/enketo-core/issues).

Thanks @martijnr, I have just tested in ODK Collect and it works fine - neither of those two issues are a problem. So I suspect that it is a bug in Enketo.

Cheers!
Jenny