Select to view content in your preferred language

URL Parameter changes in February 2024 AGOL update - data filter

712
3
Jump to solution
02-29-2024 04:25 AM
elpinguino
Occasional Contributor III

Hi there, I applied url parameters in my map last month. (Still new to it.) I've read through the new URL parameter instructions, but haven't managed to wrap my head around it.

I was using data_filter and data_id in my URL parameters.

In the updated version does # replace ? in data_filter? Or is this one spot where ? won't be deprecated?

This was my expression that used to work, but with the latest update now is unfiltered across the board.

https://experience.arcgis.com/experience/<AppID>/?data_filter=<thelayer>%3AOperationName%3D%27TestSite%27%2C<thelayer>%3AOperationName%3D%27TestSite%27%2C<thelayer>%3AOperationName%3D%27TestSite%27&data_id=<otherlayer>%3<objectid> 

I tried changing it to:

https://experience.arcgis.com/experience/<AppID>/?data_filter=<thelayer>%3AOperationName%3D%27TestSite%27%2C<thelayer>%3AOperationName%3D%27TestSite%27%2C<thelayer>%3AOperationName%3D%27TestSite%27#data_s=<otherlayer>%3A<objectid>%3A<desiredobjectid> 

I think I might be confused here by the addition of the id, geometry and where options. Everything in my ExB relates back to the map so if I can get it filtered there the filter should flow through into the other widgets.

The result I'd like to see in the map is two layers and one table to be filtered to OperationName=TestSite with the map centered on the #data_s.

Thanks in advance for your help. Looking forward to having this up and running. Means less work for me later 🙂

1 Solution

Accepted Solutions
Shen_Zhang
Esri Contributor

Hi @elpinguino, thank you for your feedback!

For data_filter, we have introduced a change related to URL decoding. We used to split the URL parameter key-value pairs after decoding the URL, while sometimes there may be commas (or other unsafe characters used for delimiters) in the values - in those cases, the URL cannot be split correctly. Since the Feb 2024 release, the URL will be split first and then the split segments will be decoded, which means that the characters used for delimiters cannot be encoded, you should only encode the values. To make your original data_filter work, you need to change your URL to:

?data_filter=<thelayer>:OperationName%3D%27TestSite%27,<thelayer>:OperationName%3D%27TestSite%27,<thelayer>:OperationName%3D%27TestSite%27

Please see the link above that all the semicolons and commas are not encoded. 

This change was meant to deal with the unsafe characters in the parameter values, please refer to the documentation for more details. I understand it requires extra work from you and I apologize for the inconvenience. 

The data_id will continue to work for now but will be deprecated soon. data_id will be replaced by data_s automatically when you open with the URL.

 

Shen Zhang

View solution in original post

3 Replies
elpinguino
Occasional Contributor III
0 Kudos
Shen_Zhang
Esri Contributor

Hi @elpinguino, thank you for your feedback!

For data_filter, we have introduced a change related to URL decoding. We used to split the URL parameter key-value pairs after decoding the URL, while sometimes there may be commas (or other unsafe characters used for delimiters) in the values - in those cases, the URL cannot be split correctly. Since the Feb 2024 release, the URL will be split first and then the split segments will be decoded, which means that the characters used for delimiters cannot be encoded, you should only encode the values. To make your original data_filter work, you need to change your URL to:

?data_filter=<thelayer>:OperationName%3D%27TestSite%27,<thelayer>:OperationName%3D%27TestSite%27,<thelayer>:OperationName%3D%27TestSite%27

Please see the link above that all the semicolons and commas are not encoded. 

This change was meant to deal with the unsafe characters in the parameter values, please refer to the documentation for more details. I understand it requires extra work from you and I apologize for the inconvenience. 

The data_id will continue to work for now but will be deprecated soon. data_id will be replaced by data_s automatically when you open with the URL.

 

Shen Zhang
elpinguino
Occasional Contributor III

Hi @Shen_Zhang , Thanks for explaining that in a simple way for me. I'm still learning how to use URL parameters and didn't understand all the terminology. I did what you showed and have encoded only the values, not the delimiters (commas, colons, etc.). It is working for me now.

What is the best way for me to know that the change from data_id to data_s needs to be changed in the URL parameters? Do I need to watch the forums? ArcGIS Blogs? There will come a point when it won't automatically update for me right?

If I update to #data_s now is that going to cause any issues down the track. Is there any reason I'd want to wait to make that change since I'm already in the data now updating the URL parameters?

0 Kudos