1. What is the problem? Be very detailed.
Hello, I have a consumption questionnaire with multiple consumption categories (food, household durables etc.), each with a select_multiple response and some follow-up questions.
Given that I have 12 consumption categories, I do not want to write out the code for each category separately (making changes would become a nightmare), but I want a way to loop over some kind of 'meta-list that contains the list_names associated with each consumption category so that on each iteration of the loop it calls the appropriate list_name moving sequentially through all 12 consumption categories.
Just wondering what the most efficient way to program something like this is?
2. What app or server are you using, and on what device and operating system? Include version numbers.
Windows KoboCollect
3. What you have you tried to fix the problem?
My first impulse was to write a calculate block that takes the repeat position and checks that against a series of if statements that create a variable containing the appropriate list_name for the given repeat position. However, I have noticed that the if statements in ODK always have an 'else' attached to it, and do not know how to get it to return "nothing". Thus ensuring that if statement calls further down the block do not override any populated value.
4. What steps can we take to reproduce the problem?
5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.
I have attached a rough example of what I am trying to achieve, you will see in the select_multiple the list is trying to be dynamically drawn from the reference variable "consume_list", but I am still too new at this to understand the proper way of going about this.
test_repeat.xlsx (14.9 KB)