Looping according to multi select, but add title of choice in each iteration

I searched if this was answered before, but couldn’t find any (sorry if I missed it).

My problem is the following:
Consider question 1 a multi select with A, B, C, D.
I made a loop depending on the count of the choices. For example, if A and C were chosen, there will be 2 iterations that contain question 2.
What I want is to add a note field before question 2 (regardless the question) that says: Section A or Section C (depending on the 1’s selects). How can I fetch the value of the selected choices in 1 and put them accordingly or use them in the loop?

Thanks a lot.!

P.S. I couldn’t upload attachments since I’m a new user (as the error message told me).

Hi @ak94
Welcome to the community forum. Having looked at your topic. I believe the discussions that have happened previously such as the one below would definitely help you with your issue.



Welcome @ak94,
Beside the jr:choice-name function Stephane mentioned,
see https://getodk.github.io/xforms-spec/#fn:jr:choice-name,
also the selected-at may contribute to your solution.
See https://getodk.github.io/xforms-spec/#fn:selected-at

Here is example with both elements (but more complex as repeat inside repeat) https://community.kobotoolbox.org/uploads/short-url/9P9fJJrStEihs9kY0zuQ5Fkv338.xlsx

Here is an example with skip (instead of loop:


Maybe this post discussed previously should also help you address your query:


Thank u for ur input @stephanealoo! I have already seen this before posting. Luckily, @Kal_Lam’s suggestion was exactly what I was looking for!

1 Like

The links are highly beneficial @wroos, thanks! @Kal_Lam too posted exactly what I was dealing with.

1 Like