Is it possible to use a LIKE statement (or equivalent) in a choice_filter?

1690
7
01-22-2017 10:03 PM
DanJoyce1
New Contributor II

I want the end-users to select a single Spot Check Code (A, B, C or D).

I then want to use that value in something similar to a LIKE statement to extract matching records from the external_choices tab.  There are different combinations of A, B, C & D depending on inspection frequency for each feature, so an exact match does not work.

XLSForm currently looks like this:

In testing, I also noticed that using an OR operator returned no records...I expected that all records with a matching CP_System would have been returned.

Has anyone done something similar?

0 Kudos
7 Replies
DanJoyce1
New Contributor II

Are the commas if the Spot_Check field potentially messing things up?

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Survey123 doesn't support multiple values in a filter - you would need to create a listing of CPTP_Name and individual spot_checks

On the or, try 'or' lowercase - that works for me.

DanJoyce1
New Contributor II

Thanks James.  Are there any plans to add more advanced filtering options or is it a limitation of the XLSForm?

I had tried 'or' as lower case but it returned no records.  Will a null entry in one (or both) of the fields I'm filtering on upset the filter?  Do I need to change null entries to some default value like 'NaN' or -999?

0 Kudos
ByronTsang
New Contributor II

found this after hunting for a similar answer... Is there any plan to add support for multiple values in a filter int he future? or is there any comparable work-around? I have a similar but more complex system that would be very straightforward with multiple value filters, but which would need a very long and redundant list of choices to dot he same with single values.

0 Kudos
DougBrowning
MVP Esteemed Contributor

I do this on my choice filters just fine.  Maybe I am reading the question wrong

Type=${woody} or Type=${none} or Type =${unknown}

0 Kudos
ByronTsang
New Contributor II

actually i'm trying to go the other way around. I want a single choice in my choice list to be available for any of several responses to a single question, as opposed to matching responses to several questions. I believe this is what Dan was going for in the example above with the Spot_check column in his choices list with some choices matching to multiple different possible responses to the CP_system question (A, B, C, or D). 

0 Kudos
DougBrowning
MVP Esteemed Contributor

Yea i am just saying it may be clunky but it can be done.  Just have one column per choice with a Yes/No is really not too bad.

My fear is even if contains worked it would be too slow.  I found that each or statement I added to my choice filter added a full second on to my repeat load time!  I spent a lot of time trying ways to make this faster and this is what I came to.

0 Kudos