Hi ExBers,
I want to apply the data_filter in my URL parameters. I was linked this article to follow. https://doc.arcgis.com/en/experience-builder/latest/build-apps/url-parameters.htm#ESRI_SECTION1_0A01...
I have some experience using ArcGIS Assistant and URL parameters in Dashboard, so understand a little, but not a whole lot.
I have three layers I want filtered, and I want these to filter in the web map and all the other widgets which have triggers and actions on them.
I want them filtered at the time of the user enters the Experience Builder. Previously I was querying the layers in Map Viewer and that meant a long ExB set up time anytime we switched out the web map.
How do I know which data source is 1, 2 and 3? Do I figure that out by looking in Experience Builder's data source properties of the map or should I have a look in ArcGIS Assistant?
This is what I've tried using our Test site and with the appid removed for privacy purposes.
https://experience.arcgis.com/experience/<appid>/?data_filter=ds1:OperationName%3D%27TestD%27,ds2:OperationName%3D%27TestD%27,ds3:OperationName%3D%27TestD%27
This is the query I want to apply to all of them- OperationName=Test or should it be OperationName='Test'?
Hopefully you can point me in the right direction.
Here is an easy way to identify the datasource Id of a layer:
Video is private, any chance you could make it available?
@MichaelGaiggEsri Great video- Easy peasy lemon squeasy. haha! You've got another follower.
To add a curve ball to that. I left out some info that in hindsight is essential. The three layers I want to filter in the map/widgets are all sublayers of one feature service (sub layers 45,47 and 48). Watching your video reminded me of that... So they are all dataSource_1 (ds1 for data_filter). I've tried to filter all of them, but only the first one listed seems to apply the filter.
https://experience.arcgis.com/experience/<appid>/?data_filter=ds1-xxxxxxxxxxx-layer-45:OperationName%3D%27Test%27,ds1-xxxxxxxxxxx-layer-47:OperationName%3D%27Test%27,ds1-xxxxxxxxxxx-layer-48:OperationName%3D%27Test%27
So I haven't solved it fully, but wanted to give you a status update since you were so quick to make that video reply. Thanks!
Glad you liked the video 😉
Looks like your values are strings, try adding single quotes (') around the values. If that doesn't work, maybe you need to use url escape characters (https://www.w3schools.com/tags/ref_urlencode.ASP)
' = %27
, = %2C
etc.
As a url parameter newbie it took me a while, but I finally solved it, and now this should save me loads of time when I need to add in new operations.
Michael helped me out a lot with his video explanation and think through the process a bit more.
As a note for people new to url parameters that might want to apply data_filters to their workflow these are some things to be aware of:
It would be worth considering putting points 2 and 3 in the URL Parameter section of the Experience Builder documentation as it would help more URL Parameter beginners to explore its possibilities and applying it to their projects.
Hi @elpinguino
Thank you for the suggestions above on data filter parameters. As some new URL parameters will be introduced in the upcoming Online release, we will update the documentation, of course with some of your ideas!
As you mentioned on URL encoding, the best way to make data filters work is to make sure the filter value is encoded. Do not encode characters used for delimiters. This is an example:
?data_filter=ds1:objectid%3D1,ds2:fieldA%3E2
"," ":" and "=" are used for delimiters, and should not be encoded. Although we also have some logic implemented for tackling these cases, the best way to make the URL work is to encode the values only.
Hi,
I just wanted to say that I think that the point "Filter data sources" of the documentation (https://doc.arcgis.com/en/experience-builder/latest/build-apps/url-parameters.htm) is not clear in this case because we had to discover that ds1 or dataSource_1.... is composed by id of the webmap and id of the layer. Something like this:
*https://<url_portal>/apps/experiencebuilder/experience/?id=<id_app_exb>&data_filter=<id_webmap>-<id_feature_layer>:<field_name>%3D<value>
We will be grateful if this is explained. Thank you in advanced,
Alex
Greetings All,
I’ve been conducting some testing on passing two data sources through URL parameters in Experience Builder, and I wanted to share my findings.
Data: hosted feature service in arcgis online with a related table.
Experience builder: ArcGIS Online (current online release)
While reviewing the documentation, pay close attention to the notes—especially where ESRI states
The data_s parameter is now the recommended approach.
Link to ArcGIS Experience Builder URL Parameters
Using ESRI’s example as a starting point:
https://experience.arcgis.com/experience/<AppId>/#data_s=where:widget_1-dataSource_1-1871234a785-layer-2:a>1
II was able to construct a custom URL of my own:
https://experience.arcgis.com/experience/<appid>#data_s=where:<dataSource ID>:<field name>=<attribute>,where:<dataSource ID #2>:<field name>=<attribute>
Here is a live site example:
Link to Property Search experience Parcel 31-2-0273-50
In this case, the URL first references the feature class (dataSource_8-0), then the related table (dataSource_8-2), but switching the data source order still yields the same result.
Tip: If you're filtering your data, be sure to check the encoding guidelines in the documentation. My experience uses the "Selected Data" content type, but to avoid any issues, I recommend building the encoding directly into your URL for consistency.
Cheers,
Heath