List not selected items from select_multiple

List not selected items from select_multiple in a repeat group

join( ', ', instance(‘option_crop’)/root/item[not(selected(name, /data/option_crop))]/label)
this is not working

@bibekhood, you may need to share the relevant part of your XLSForm with the community. Please note just the relevant. Please also elaborate on what you intend to achieve.

You were close, but your selected() syntax wasnt quite right. Try this:


NotSelected.xlsx (15.3 KB)

I’ll leave it as an exercise for the reader to extend this across multiple selects in a repeat group… :slight_smile:

3 Likes

Hi Gareth, Many thanks.
I did exactly the same coding as yours



but got the following error:

Well, that’s interesting. :thinking: I tested the form thru the online validator - and it runs fine.

Sorry, I’m investigating now…

Ok, got it. The problem is the current version of pyxform we are running does not always convert option lists into nodesets, upon which the ‘secret sauce’ join( ', ', instance(‘options’)/root/item[not(selected(${values},name))]/label) depends… [whereas the new version of pyxform, which the online validator is running, does convert all selection options into nodesets].

The interim fix is to force pyxform to always convert the options into a nodeset, by adding a dummy choice_filter of true().

NotSelected.xlsx (15.4 KB)

Please try the above form instead. It should deploy OK now in Kobo too.

FWIW, this quirk should go away shortly as we are in the process of updating Kobo’s pyxform, after which this dummy choice_filter workaround will no longer be necessary (thankfully it doesn’t do any harm being there, so you can leave it in)

3 Likes

BTW, @bibekhood, if you do wish to do this, please share your solution here! :wink:

join(', ', instance(‘option_crop’)/root/item[not(selected(/data/repeat_group/option_crop, name))]/label)
Ensure option_crop instance and repeat group path are correct for it to work.