Hello All,
I have a survey where we ask what crops a household grows, and then we ask
some follow up questions about each crop. The follow up questions are
structured in a repeat loop.
So that we know what crop each repeat loop refers to, the first question in
each loop is 'which crop will you ask about?'. Using the choice_filter
function they can select_one crop from the list of crops already given.
However, I would like to refine this further by removing options from
subsequent loops which have already been entered in previous loops. I am
almost there, as you can see in the attached file, using code along the
lines of:
"selected(${crops}, name) and not(selected(indexed-repeat(${crop_name},
${crop_repeat}, 1), name)) and not(selected(indexed-repeat(${crop_name},
${crop_repeat}, 2), name)) and not(selected(indexed-repeat(${crop_name},
${crop_repeat}, 3), name))"
But there is a problem! If I go back through the form to revise an
answer, and then skip forwards again through the loop iterations then the
option to select each crop disappears.
I have tried using indexing relative to the repeat loop position (see
below), but when using Collect I get an error saying I need to use the
index-repeat function.
"selected(${crops}, name) and not(selected(indexed-repeat(${crop_name},
${crop_repeat}, position(..)-1), name)) and
not(selected(indexed-repeat(${crop_name}, ${crop_repeat}, position(..)-2),
name)) and not(selected(indexed-repeat(${crop_name}, ${crop_repeat},
position(..)-3), name))"
Any ideas ???
Many thanks
Jim Hammond
Repeat_filter_example.xls (29.5 KB)