For anyone interested, I figured out an acceptable workaround if anyone finds themselves in a situation where they need to auto-populate a select_multiple based on what was selected in a previous select_multiple question. I got the overall idea of how to do this from the Repeats documentation.
- Create a repeat that has a max repeat count of selected items in the first select_multiple using count-selected()
- Inside of the repeat, use selected-at(${question_name}, pos(..)-1) to get each individual item selected into its own repeat.
- Use pulldata() to get associated attributes of each selected item
- Outside of the repeat, use join() to concatenate all attributes into a comma separated value
- Remove duplicate entries in the comma separated value (otherwise when you go to submit it will fail). I wrote a function to accomplish this in Javascript:
function dupeclear(ppe_formatted_text) {
var x = ppe_formatted_text.toString();
x = Array.from(new Set(x.split(',')));
return x;
}
6. Use the cleaned up concatenated value as a calculation for the second select_multiple.
Please note that the only downside to this method is that you need to cycle through each repeat manually to get the text field outside of the repeat to pull each value in. Once I figure out how to do that through a calculation (if possible) I will update the post.
I probably didn't do the best job in writing this out so I'm also attaching the final sample workflow along with some notes in the hints of each field to this post.
Alex Bakhtin