Select to view content in your preferred language

Dynamically auto-fill a select_multiple

1031
7
03-26-2021 04:14 PM
EricRoss1
Emerging Contributor

Our survey involves collecting some point data, and then that at those points, collecting measurements of several individual seed heads. The types of measurements that get done on those is dependent on the species. I'm trying to find a way to have the measurement types needed be automated using the species name. A key point here is that the list of species/measurement types may grow quickly over time so I'm trying to keep the way to accomplish this lightweight and avoid using 'if' statements for every species/measurement combination.


As it stands, I'm using regex(species, ${species}) to filter the choices, so that the select_multiple for the measurement types gets adjusted based on the species, but we want the observers to always do all of the measurements that apply, so an ideal scenario would be where the select_multiple just auto-fills with all of the eligible options and not even be visible to the observer instead of what we have now where they have to select every visible option. We do have a species observation csv where I added a column for the number of measurement types the species needs and used that as a constraint so that the observer doesn't accidently not select all of them, but I'm just posting here in an effort to streamline the process and minimize the amount of columns/data someone needs to maintain on the backend.


Thanks!

EricRoss1_0-1616797162214.pngEricRoss1_1-1616797289034.pngEricRoss1_2-1616797318333.png

EricRoss1_0-1616800255221.png

 

0 Kudos
7 Replies
DougBrowning
MVP Esteemed Contributor

No there is no way to have the UI select something for the user. 

Usually if you know the response then there is no need to ask the user just store it.  But in your case you want to store multiple answers.  I am not sure what you data looks like but could you have a pulldata with a choice and the answer?

Like

Species1   1,2,3,4,5,6

Species2    3,6,10,11

Species4    7,10,13

Hope that helps.

 

0 Kudos
EricRoss1
Emerging Contributor

Hello Doug,

Thank you for the response and suggestion. We would always know the answer so it'd be ideal if we could just populate it. What I have now is just a workaround that requires some user input since, as far as I know (and unless it's recently changed), you can't use a pulldata() to populate the values of a select_multiple. 

But yup, our data in the csv would look like what you wrote out:

species1    shlength,f2tlength

species2    shlength

species 3    shlength,f2tlength,SomeOtherMeasurement

0 Kudos
DougBrowning
MVP Esteemed Contributor

Ok then I would just use pulldata for this.

You can have a CSV with all these lookups in the media folder.  Then just pull the answer into a note field.

See https://doc.arcgis.com/en/survey123/desktop/create-surveys/prepopulateanswers.htm 

Hope that helps

0 Kudos
EricRoss1
Emerging Contributor

I've tried pulldata before and it looked like it only pulled the first value. Tried it again and got the following results:

EricRoss1_0-1617036998286.pngEricRoss1_1-1617037022066.png

EricRoss1_2-1617037048355.png

Am I missing a step in the process?

0 Kudos
DougBrowning
MVP Esteemed Contributor

Prob due to using commas.  It is a csv remember so commas would mess it up.  The default for a select multiple is ; so try that instead.  Or spaces maybe.

0 Kudos
EricRoss1
Emerging Contributor

Sure thing. So changing that get's it imported as a note, ex: "sh_length;ft2_length". Sorry if it's a dumb question, but is there then a way to transform it once that's in survey 123 to have it so the select_multiple recognizes it as values, since that requires a comma instead of the semicolon?

0 Kudos
DougBrowning
MVP Esteemed Contributor

select multiple actually uses spaces.  But there is no need to do that just show the values in a note.  select multiple is not needed.

Sorry I am getting a bit lost on what you are trying to do now.

0 Kudos