How can you tell survey123 to auto select all of the choices for a select_multiple field when a field above is answered? This is based off a choice filter. I'll provide my form below, but I'm trying to build a survey where depending on which office, users will be select automatically. Hoping to use this with inbox so that paperwork goes to a group of people. Please let me know if you can help!
Note* I am using the survey 3.11 beta that allows you to use choice filters on select_multiple choices but is there a way to select multiple choices regardless? Thanks!
Solved! Go to Solution.
Hello Jordan Miller,
There is likely a simpler way to clean up the calculations, but what I have thought of so far was to add calculate fields that will return users based on the selected department.
For example:
if(selected(${department_1},'Engineering ID 1500'),'jim,bob,sally','')
You can then use the calculations in the select multiple question.
Since there looks like there may be quite a bit of calculations the syntax that I had tested with on the select multiple question was:
${cal1} or ${cal2} etc.
I have attached your sample XLSForm with a few modification. Although I will continue researching to see if there is a more efficient workflow to simplify the calculations.
Thank you,
Zach
Hello Jordan Miller,
There is likely a simpler way to clean up the calculations, but what I have thought of so far was to add calculate fields that will return users based on the selected department.
For example:
if(selected(${department_1},'Engineering ID 1500'),'jim,bob,sally','')
You can then use the calculations in the select multiple question.
Since there looks like there may be quite a bit of calculations the syntax that I had tested with on the select multiple question was:
${cal1} or ${cal2} etc.
I have attached your sample XLSForm with a few modification. Although I will continue researching to see if there is a more efficient workflow to simplify the calculations.
Thank you,
Zach
This is amazing! Do you know if there's a way to setup inbox to read the choices?
I know with a single selection we are able to use field=${username} but when you add more like ", person1 , person 2"
it's unable to read.
In ArcMap I've used this WORKORDERID LIKE '%20161008%' becuase it's able to find that string but
LIKE '%${username}%' doesn't seem to be a valid expression. Any help would be greatly appreciated!
Hello Jordan Miller,
You can set the instance name on the settings sheet in the XLSForm to read from your username question.
For example the instance name could read:
concat("Workers: ", ${workers_1}), which will return the string Workers: <choice names from the question>.
We have an enhancement requesting instance names honoring choice labels in the Inbox and Sent box instead of returning the choice name. The enhancement number is ENH-000126922, I would suggest opening a case with Esri Technical Support to attach your customer number to the enhancement that way you will be notified when further updates are available on the request.
Thank you,
Zach
Hello Jordan Miller,
A workaround for the Enhancement would require quite a bit of calculations, but can be done using the jr:choice-name() function.
I have attached a sample XLSForm that calculates a hidden question to be used as the instance name. Since the jr:choice-name() function can only take one input the selected-at() function is needed to grab specific choices from the select multiple question.
For example:
jr:choice-name( selected-at(${workers_1}, 0), '${workers_1}')
Once those are defined an if() statement can be used to return varying results from the jr:choice-name() calculations.
For example:
if(count-selected(${workers_1})=3, concat(${name_0}, "," , ${name_1}, "," , ${name_2}), if(count-selected(${workers_1})=2, concat(${name_0}, "," ,${name_1}), ${name_0} ))
This sample says if there are three selections in the select multiple return all jr:choice-name() calculation fields, otherwise if two are selected return those two labels, otherwise return only the first selection (assuming that only one choice has been selected) or nothing.
Thank you,
Zach
Im intrigued, what does the ${calwork} or ${calwork2} calculation do?
I would have assumed "or" returns either True or False but seems it works more like coalesce in this instance?
Since when does an "or" calculation return a string 🤷:male_sign:
Thanks for posting this idea @ZacharySutherby. I found it helpful.
@DeonLengton - I found ${calwork} or ${calwork2} did not work, but concat(${calwork},",",${calwork}) did.
It looks like the point is to pass the multi-select a string. Even if either of the calworks were "", the multi-select was populated correctly.
This solution works for me but I have a lot of duplicate choices. Also, I have would have to write 74 different calculate rows. Highlighted in yellow is the same information. As you can see in blue the same answer can be used for 3 different selections. Can Y802, Y812, and Y822 be combined to all relate to 3174? Currently if you selected all three of those gangs then 3174 shows up three times.