Syntax to search substring for selected(question,value)

04-11-2018 03:29 PM
New Contributor II

I'm hoping to create a pop-up note when a selected response is not within a list of set responses. I believe it is possible using the selected(question,value) formula in the relevant column and some sort of substring search, but am not sure what the syntax might be.

The survey is for plant species, and I would like to pop up a warning if the user records a plant that is not within it's known range (list of counties). My thought is that I can have the user select the county they are in, and then use that response to search for a match in the range list.  I think the structure might be something like: selected(${County}) %in% Range, but I don't know how to go about a substring search in Survey123 syntax.

select_one countyCountyCounty
begin repeatplantListSpecies
select_one speciesspeciesSelect Species:
noteoutside known county
end repeat

Survey Tab

example of species data from choices tab

speciesPseudelymus_saxicolaPseudelymus saxicolaBeaver, Box Elder, Cache, Carbon, Daggett, Davis, Duchesne, Emery
speciesAbies_sp.Abies sp.Cache
speciesAchnatherum_parishiiAchnatherum parishiiCarbon, Dag
0 Kudos
3 Replies
Esri Regular Contributor

Hi Miles

Have you considered using cascading selects?

This way you could use the county as a choice filter on the species list, and the user would only be able to select a species that exists within the county they selected.

This would work if you were not to use ranges, but instead break them up into counties. You would need to have a record in the choice list for each species in each individual county:






Pseudelymus saxicola

Pseudelymus saxicola


Box Elder

How many species and ranges are we talking about here - is this possible?

There is a sample for cascading selects in Connect and the help is here: Cascading and external selects—Survey123 for ArcGIS | ArcGIS 



New Contributor II

Jonathan - 

Thanks for the help!  I was hoping to have an entire state's worth of species in the list (~4,000 species), and thought that having each county list would be to large, but I've limited the species list to a limited number of counties within the work area, and the cascading select to get a county species list is a great approach. 

New Contributor II

Another approach I've come up with is to avoid the county species lists, and load one list of the entire state species list into the external choices and link it to a question in the choices tab to enable autocomplete search for species. To supply additional relevant info that I want to see but don't need to edit (i.e- which counties it's known from, it's nativity, and state sensitivity) I've put this info into a .csv in the media folder and used a combination of calculate question and pulldata, and note questions to pop up a species nativity, sensitivity, and known locations after selecting it. It is nice to have the entire list as there are some species that are known to occur in the state, but do not have any county records listed in the USDA plants list (yet).