Create a question list from a lookup table checkbox

Hi,

I have a lookup table question which is “select state” then “select cities” where the list of the cities are only those belongs to the state that was just selected. Then I wanted to ask if the cities selected are accessible. For example, if I choose California, then San Francisco, Los Angeles and San Diego, I hope to create a question list asking if each of the 3 cities are accessible, so “SF yes or no, LA yes or no, SD yes or no”. Is this kind of question list doable in CommCare? Thanks!

Yes. CommCare’s Lookup Tables feature is able to easily accomplish tiered filtered lookups. Our wiki has a guide which can help you to implement that workflow in your apps.

Hi Clayton,

Thanks for the quick reply! My apologies for not being clear, but my problem is to build the question list, not the lookup table itself! Say that I’ve already selected the cities in the checkbox question, how can I create the question list to ask the same question (accessible or not) to each of the cities selected?

Hey there

that’s a little bit trickier.

you would need to:

A- count how many answers were selected
B- create a repeat group, with that number a count of repeats
C- inside the repeat: Use a position() to get which repeat you’re on, and then use that value with Selected-at() and that multiple choice question. this way, you can correlate a repeat with an answer.
D- show that answer in a label inside the repeat
E- ask the rest of the questions

HTH

Mazz

1 Like