Select to view content in your preferred language

Webmap layer filter by "contains"

5226
21
Jump to solution
11-21-2018 08:01 PM
NaomiBegg2
Occasional Contributor III

I have a layer which is created in Survey123.  One of the questions is a select multiple type. On this question I want to create layer filters so that if it contains a certain text then it will appear in the layer.  The only options I can see is for it to be exactly one thing (or not or blank).

I have 6 different options within the multi type question.  That leads to 61 different selection combinations.  I was hoping that this tool would save me from having to create 61 different test surveys so that I can group them all which would look like (issues is a AND issues is b AND issues is c AND ...)

Is there any other way I can do this? Am I missing something obvious?

21 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Naomi,

A select_multiple field is stored as a string (text) field and should have the option for contains in the filter, as in this example:

There should not be a domain (choice list) associated with a select_multiple, as that prevents the multiple values from being displayed (multiple values are stored as a comma-separated list, so the combinations rapidly become more than we want to store in a domain)

A select_one question (which is discussed in the comments) is stored as a string field with a domain (the choice list) which restricts the value to only a predefined set.

Did you originally create the question as a select_one and then change it to a select_multiple later?  If so, you will need to remove the choice list.

0 Kudos
NaomiBegg2
Occasional Contributor III

This has always been a select_multiple layer and is required to be. If you see this question you will see that the domain  names didn't follow through on the layer https://community.esri.com/thread/224848-domain-values-from-survey123-not-showing-in-webmap

I do require domain names however as the choices have been created in code which would mean nothing without the domain to turn it into English. Therefore I started to created the domains within the layer on AGOL.  If I were to remove these how would I then have a correct label showing that_doesnt_look_horrible_like_this ?

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Naomi,

As I mentioned above, domains can't work with select_multiple questions - domains allow only one choice to be saved.  To display human-readable labels for a select_multiple question, you can use an Arcade expression - see https://community.esri.com/groups/survey123/blog/2018/10/10/labels-for-multiple-choice-questions-usi...  

NaomiBegg2
Occasional Contributor III

Great, that was the direction I needed  Along with this bit which showed me where to actually put the code! https://community.esri.com/groups/survey123/blog/2017/12/18/use-arcade-to-improve-survey123-other-an... 

In the end I chose a simple Replace statement.

0 Kudos
by Anonymous User
Not applicable

Hi James, 

I have this exact same problem, with an active survey. I don't understand how to remove the choice list, so I can choose "contains" to filter my field by, without having survey respondents lose the choices they select from? Can you elaborate on what the fix is here so that my users can still "select multiple" in an active survey and I can select "contains" as a filter in my web map?

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Erica,

The fix is only in the web map that displays the results, not the form.  The blog post

Labels for Multiple Choice Questions Using Arcade describes how to make a custom Arcade expression for viewing the list of choices; you would then modify the web map's pop-up to not display the multiple choice question directly, but rather the Arcade expression.

0 Kudos
by Anonymous User
Not applicable

Thanks for the quick reply! I'm fine with the way things show up in my pop-up, but I want the users in my web map to be able to choose "contains" when filtering, instead of "is". This is possible for this "select_multiple" field in my layer in Survey123, but not via my web map. Is there a fix?

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Erica, 

If there is a list attached to a field, it should be removed.  See the 'Delete a List' topic in Define attribute lists and ranges—ArcGIS Online Help | Documentation 

0 Kudos
by Anonymous User
Not applicable

In that section, it looks like if I delete that list, the users of my survey will no longer be able to have those values to choose from. I don't want them to have to remember the choices...

0 Kudos
JamesTedrick
Esri Esteemed Contributor

The choices presented in a Survey123 form are defined by the form file, not the list of choices (as mentioned above, lists of choices should never be used for a multiple choice question).  Removing the list from he feature service does not affect Survey123; other applications that display a dropdown to let the user choose 1 choice would be affected.