Select to view content in your preferred language

Dynamic Choice Filter using Search() from Feature Service

269
3
07-17-2024 10:29 PM
DominicReed
Occasional Contributor

Hi good people, 

I was following this fantastic blog for s123 customisation by cascading selects: https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-choice-filters/bc-... 

I was wondering, if it is possible to make a dynamic cascade (did not find what the term should be). Like I have connected a world administrative boundary feature layer from a feature layer. I have questions for Continent>Region>Country>Locality. I would like to give the user to select either one of the administrative units first and then the cascade will work dynamically, like if the user chooses country first, other admin units will be filtered out.

Is it possible? Can anyone help??

0 Kudos
3 Replies
JenniferAcunto
Esri Regular Contributor

For the search appearance, you do not use the Choice Filter column, instead you build that filter directly into the search expression using the Filter Column and Filter Text parameters.

search(‘tableName’, ‘searchType’, ‘searchColumn’, ‘searchText’, ‘filterColumn’, ‘filterText’)

The Dynamic Choice Lists using Search Appearance’ sample survey available in Survey123 Connect shows examples of how to set this up. Specifically, lines 11 and 16 for the example you describe.

 

- Jen
DominicReed
Occasional Contributor

Hi @JenniferAcunto,

Thanks for your reply. I went through the sample search appearence form, it somewhat solves my problem. However, what am I wanting is to filter the questions dynamically. Like here is the sample expression for the first question, selecting the US State: autocomplete search("state?url=https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_States_Generalized_Boundaries/...")

and this is for the second one, selecting the county: autocomplete search('county?url=https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Census_Counties/FeatureServer/...', 'matches', 'STATE_NAME', ${us_state})

What I am wanting, is to give users select either state names or the county at first. In the form, user selects Delaware and the three counties of Delaware filtered out. However, I want to load all the counties and states at first and then filter out one on the respect of other. suppose, if somone selects 'New Castle', only Delaware can be selected from the previous one. Again, if someone selects 'Lincoln' from the county list, all 25 states with a county named Lincoln will be filtered out in the first question. 

This I can not achieve. Can you help in this regard?

 

0 Kudos
JenniferAcunto
Esri Regular Contributor

So you want everything but the options associated with the first question? That is not possible with the search appearance, as you would need 'does not match' instead of 'matches' which is not a thing. You would have to use a static select list and choice filters to do something like this.

- Jen
0 Kudos