Checking the selected item in select1 inside a repeat group

I've a repeat group that starts with a select1 prompt, other questions that
follow in the group is based on the item selected from the select1
(relevants). Every item in the select1 is mandatory and should be asked
only once. How can I validate that an item is not selected again. Is there
a mechanism to somehow avoid selection of already selected item. I've
defined the select1 as

मसिनो चामल FRICE खस्रो चामल CRICE ' ' '

There is no built-in mechanism.

If the N choices need to be processed in a certain order, your form can
first have a 1-question repeat group to ask for the ordering, then verify
that there are no duplicates in the ordering, and then have a repeat group
that asks for the answers to your detailed questions for the 1st choice,
2nd choice, etc.

In that second repeat group, you can reference the selection made in the
first repeat group by writing an explicit XPath to that selection field
within that 'firstrepeat' repeat group. e.g.,:

/data/firstrepeat[position(..)]/selectionfield

And you can use jr:choice-name() to get the display name for that choice.

You might need to create some calculated fields to get at this information.
Read up on how to reference a field in the form. When using repeat groups,
${fieldname} will generally not work. You need to become skilled at
referencing fields either using relative XPaths (../fieldname) or absolute
paths like the one above.

··· On Wed, Jul 15, 2015 at 1:48 AM, ChangbangMobs wrote:

I've a repeat group that starts with a select1 prompt, other questions
that follow in the group is based on the item selected from the select1
(relevants). Every item in the select1 is mandatory and should be asked
only once. How can I validate that an item is not selected again. Is there
a mechanism to somehow avoid selection of already selected item. I've
defined the select1 as

मसिनो चामल FRICE खस्रो चामल CRICE ' ' '

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

Thanks Mitch, I did manage to use your suggestion and have had a flying
start on the solution. Thanks a ton. I am having some trouble implementing
the relevants though. I am suffering with getting the value of the selected
item from my multiple select (outside the repeat group, the group where the
implementation of relevant needs to be done) list to use it in the relevant.

  1. I started off with a multiple select question ITEMLIST (readonly, all
    selected) outside a repeat group.
  2. That limited my repeat loop (as intended) with the count of the selected
    items in the list (count-selected(/data/ITEMLIST))
  3. I need to use the selected value of the first item in the first repeat
    loop and so forth for all other iterations (managed to get the position
  • selected-at(/data/ITEMLIST, position(..)-1) and label - jr:choice(....)
    of the items in each iteration)
  1. questions inside the repeat loop have relevants that if the item
    selected is 1 then it needs to be shown else skipped

for instance: say
I did some searches but could not implement anything. Any lead please, i
know i am almost there.

··· On Wednesday, July 15, 2015 at 2:33:56 PM UTC+5:45, ChangbangMobs wrote: > > I've a repeat group that starts with a select1 prompt, other questions > that follow in the group is based on the item selected from the select1 > (relevants). Every item in the select1 is mandatory and should be asked > only once. How can I validate that an item is not selected again. Is there > a mechanism to somehow avoid selection of already selected item. I've > defined the select1 as > > > > > मसिनो चामल > FRICE > > > खस्रो चामल > CRICE > > ' > ' > ' > >

I managed to get this done, needed some time to think and look at things
better.

I bound another string

This node, has the value of the selected items for each iteration. Hope
this helps someone in future. Thanks again to the ODK team for the
suggestions.

··· On Wednesday, July 15, 2015 at 2:33:56 PM UTC+5:45, ChangbangMobs wrote: > > I've a repeat group that starts with a select1 prompt, other questions > that follow in the group is based on the item selected from the select1 > (relevants). Every item in the select1 is mandatory and should be asked > only once. How can I validate that an item is not selected again. Is there > a mechanism to somehow avoid selection of already selected item. I've > defined the select1 as > > > > > मसिनो चामल > FRICE > > > खस्रो चामल > CRICE > > ' > ' > ' > >