Select to view content in your preferred language

Filtering with URL Paramaters using Contains or Wildcard

301
4
Jump to solution
08-30-2024 12:51 AM
DarraghOSullivan
Frequent Contributor

Is there any way to filter with URL Parameters equivalent to a 'contains' query? My use case is for recreational trails, many of which cross county boundaries, so the County field has multiple values (comma separated). URL parameters are ideal for my use case to filter by county, but using County="Dublin" only returns trails that are entirely within that county. County="*Dublin*" or similar would be ideal. Any ideas?  

0 Kudos
1 Solution

Accepted Solutions
Shen_Zhang
Esri Contributor

You can use LIKE to filter data with certain patterns, for example here I have a list of countries and I tried to filter countries whose names have "United". I used the following:

?data_filter=<dsID>:COUNTRY LIKE 'United%'

and the encoded version of it would be:  

?data_filter=<dsID>:COUNTRY%20LIKE%20%27United%25%27

 

It gave me the following result:

Screenshot 2024-09-02 at 16.14.24.png

Shen Zhang

View solution in original post

4 Replies
Shen_Zhang
Esri Contributor

You can use LIKE to filter data with certain patterns, for example here I have a list of countries and I tried to filter countries whose names have "United". I used the following:

?data_filter=<dsID>:COUNTRY LIKE 'United%'

and the encoded version of it would be:  

?data_filter=<dsID>:COUNTRY%20LIKE%20%27United%25%27

 

It gave me the following result:

Screenshot 2024-09-02 at 16.14.24.png

Shen Zhang
DarraghOSullivan
Frequent Contributor

Thank you @Shen_Zhang , that has worked perfectly!  Is there a list of such available operators somewhere? 

0 Kudos
Shen_Zhang
Esri Contributor

data_filter uses standard WHERE clause syntax, so basically whatever works in WHERE clauses, it should also work here. 

Shen Zhang
0 Kudos
DarraghOSullivan
Frequent Contributor

Super, thanks again