Calling items from one repeat group to another: for select_one questions


#1

What is the problem? Please be detailed. Hello ODK community, I would like to call items from one repeat group to another – the first repeat involves select one type of question (select one_crop), where a number of questions are asked on as many plots and crops as the farmers as (begins by asking farmer how many plots he cultivated, then ask them the main crop for each. Loops as many times as number of plots). Now, I have another set of questions that involve the same crops that were selected in the first repeat group, and would like them repeated without again asking the respondents the crops grown. I do not want to merge the two into one repeat group because they are on different topics, and again merging will make the repeat group have very many questions which are not related. I attach a sample xls file to illustrate the issue, and will most sincerely appreciate help from community members. Thank you.

What ODK tool and version are you using? And on what device and operating system version?
repeat groups_sample odk comm.xlsx (13.1 KB)

What steps can we take to reproduce the problem?

What you have you tried to fix the problem?

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


#2

Hello community, please help
Many thanks


(Grzegorz Orczykowski) #3

Hi @mugambii

please check out the changes I implemented in your form. I highlighted all of them suing green color.
repeat groups_sample odk comm.xlsx (9.8 KB)


#4

Thanks a lot @Grzesiek2010 Let me check it out


#5

Thank you very much @Grzesiek2010!


#6

Hi @Grzesiek2010 I have now encountered another challenge when I try to nest another repeat group within the "pest problems" group. It gives message "you may need to use the indexed-repeat() function to specify which value you want" when I run through the questionnaire on my tablet. I attach the xls file your kind review. I will appreciate your help. Thank you
test.xlsx (20.2 KB)


(Grzegorz Orczykowski) #7

The problem is that in pest problems you are trying to get values from questions like crop which is in another repeatable group plot_rpt so the software doesn't know from which repetition you want to get the value (1 or 2 or 3 etc.).
You are in another repeatable group so probably if you are in your first repetition you want to get a value of crop from the first repetition of plot_rpt then from second, third etc but it doesn't work by default like that. You need to specify it.

You need to use indexed-repeat you can find more info here Referencing answers from repeated questions