Select questions can use internal / external choice lists and entity lists, or by referring to a field within a repeat to use just gathered values as options.
If an array of values were created via other means (join, concat, a stored space separated list against a value), is there an easy way to convert these into a nodeset that can be used in a select?
The hard way to achieve this (tested and works in Collect, Enketo & Webforms, but Webforms shows all the repeat elements while Collect & Enketo don't as it only contains a calculate) is to:
- create/lookup a space separated array of values
- set the repeat count of repeat eg ${nodeset_generator} as
count-selectedon the array - use repeat position (-1 to 0-index it) and
selected-atto get each corresponding value and store in eg ${nodeset_item} within the repeat - access it as select_one / select_multiple ${nodeset_item}
I guess I'm imagining something like nodeset('string') that could have a concat / join / instance lookup inside it. Beyond being used for selects, it could also allow nodeset operators to be used on the newly created nodeset. Edit: I suppose a more 'useful' version of this would allow generating a nodeset with more than just name values, so something like... nodeset(name:'string1' , label::EN:'string2' , image:'string3' ...)
And why? I am trying to extend how forms can be designed and customised, so it's part 'can this be done' and part 'this would open up some design options'. I recognise that it's not a 'good' select as it's monolingual, can't have different name/label values, can't have spaces in the values... but I'm just looking to add another tool to my ODK toolbelt for a rainy day.