Hello everyone,
I am currently working on a form where I am utilizing pulldata() and select_multiple in tandem to pre-populate information into a different select_multiple field. My main question is:
Is it possible to have a select_multiple question dynamically select choices in a different select_multiple? I attached an example to this post where I'm using fruits and would like to have the colors automatically populate based on the selected fruits. Ideally I would like to utilize pulldata() as I can autogenerate the comma separated strings I need to automatically select the select_multiple choices from pulldata() but I would like to see what is possible with this setup. From my testing, I'm not able to reliably have all of the colors populate based on the selected fruits.
Solved! Go to Solution.
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.
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.
I have a similar project where I am filtering the list of counties based on the state chosen. I am not using pulldata(). In the choice_filter column of the .xlsx form, on the row asking for the county, I have a filter set looking at what was selected in the state field. I have a separate .csv file stored in the media folder that lists the counties and the states they are in. The filter looks for what counties have the state matching what the user entered for the state in the previous question.
Hope this helps.
Would you be able to please share a small snippet on how that setup looks? I think that can theoretically work for me as long as I can get things to auto-select as well within that select_multiple which would be based on a previous select_multiple question.
Thanks!
this is from the .xls form
this is from the choices-boundaries02-counties.csv in the media folder
Ah understood - I am familiar with working with cascading selects like that however I'm wondering if it is possible to preform a calculation that would automatically select options in a select_multiple based on what you select on a previous select_multiple question?
I attached a quick video but in short, is it possible to have all of the food colors selected when all of the foods above are selected? With the way I have things set up currently, I can't seem to get it to work the way I would like.
The actual calculation is happening from a pulldata() function:
pulldata('color_csv', 'food_color', 'food_name', ${food_name})
And the color_csv file contains the following contents:
food_name | food_color |
apple | red |
pear | green |
orange | yellow,orange |
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.
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.