Using check-box look-up table values in repeat-group label

I am having issues trying to use the values selected from the check-box of a look-up table in a subsequent repeat-group label.

I have a question that asks about recent travel in the last month? Yes/No.

If yes, I want to know “who” traveled, and I have a check-box look-up table that pulls in names from a roster of household members (earlier repeat group) - this works fine.

I then create the count of the selected responses to use in the subsequent repeat group using the “count-selected” function; this works fine too.

My problem is that to both guide mobile users, and also make sure to link the right response from the subsequent repeat group to the names, I want to include a label before the repeat group follow-up questions with their names (essentially the responses from the check-box look-up tables). Not all names from a household in the look-up table will be selected, and the look-up tables vary for each household.

I tried to create a name field in the repeat group, using the "selected-at(whoquestion, current()/…/repeatposition) but it doesn’t like not putting in a value itself into the “number” portion of the selected-at function. (I believe.)

Any ideas how I can accomplish this? I have several series of questions that all need to do the same thing… essentially use the values from a check-box look-up table to ask follow-up questions in a repeat group for just those responses that were checked.

Thanks in advance,

Hi Karen,

What you are doing sounds like roughly the right approach to me. I think the trick is on how the “count” of the repeats is working. It’s surprisingly challenging in xpath to get a valid integer position for the repeat.

Is the calculation " selected-at(whoquestion, current()/…/repeatposition) " is inside of a filter expression? (Ie: Between two “[ ]” characters)? If not, you won’t need to use “current” and can refer to the current relative path without it.

is repeatposition calculating properly for you outside of this expression?