Select to view content in your preferred language

URL Parameters - filter multiple values for a single data source

497
3
02-21-2024 01:22 PM
Labels (1)
RInfante
New Contributor III

Hello!

So this question applies to Experience Builder running on Enterprise 11.2.

Just like the subject says: I am trying to embed an app and want to use URL parameters to filter the records based on two different values of the same attribute, and in the same data source.

So for example, I have dataSource1 and a column called 'test' with the values 'a' and 'b'.

If I wanted to use an URL to just show the records related to "test=a', the syntax would be:

<url>&data_filter=dataSource1:test='a'

Likewise, if I wanted to filter by b, it'd be:

<url>&data_filter=dataSource1:test='b'

But what if I wanted to filter by both 'a' and 'b'? Everything I've tried so far excludes one of the parameters, and the documentation about passing multiple filters assumes multiple data sources and columns instead of from the same one. Is this just not possible in Experience Builder the way it is with Dashboards (ie. in Dashboards, the Category type URL parameter can do this = '#param=a,b')?

 

 

 

3 Replies
Shen_Zhang
Esri Contributor

Hi @RInfante 

The filter format is a standard WHERE clause syntax. To filter data with multiple values, you can use:

<url>&data_filter=dataSource1:test='a' OR test='b'

or

<url>&data_filter=dataSource1:test IN ('a', 'b')

But please remember to encode the filter values in case of the potential conflicts with preserved delimiters:

<url>&data_filter=dataSource1:test%20IN%20(%27a%27%2C%27b%27)
Shen Zhang
0 Kudos
DannyGant
New Contributor II

Good afternoon,

This doesn't seem to work on my end.  Here is my where clause.

Raw:

<url>&data_filter=dataSource1:id='MA-305' OR 'MA-178'

Encoded:

<url>&data_filter=dataSource1:id=%27MA-305%27%20OR%20%27MA-178%27

When passing both with the OR, I get no data returned.  If I remove either, I get data for whichever one is remaining.  I also tried the "IN" method, same result.  Thoughts?

0 Kudos
DannyGant
New Contributor II

I see what I was doing wrong with the OR solution (Wasn't calling the variable each time), however the "IN" method still does not work for me.  

0 Kudos