Custom Embed Widget with Multiple Data Sources

464
3
02-14-2025 05:01 AM
Labels (2)
jtermaaten
Occasional Contributor

Hi, does anyone know of a custom version of the Embed Widget that allows the app manager to set multiple datasources? I've got a point, line and polygon layer with some attributes I want to use as URL Parameters in the settings of the Embed-widget. It would be something like https://site.domain.com/url?id={id}&category={category} where id and category should be derived from the clicked feature in each of the three layers. Thanks!

3 Replies
jtermaaten
Occasional Contributor

Does anybody have a reply to this question?

0 Kudos
JeffreyThompson2
MVP Frequent Contributor

So the problem with building something like this is that the Experience Builder framework really only allows one layer to have Selected Features at any given time. There can be stuff in multiple layers selected in something like the Select Widget, but according to the Message Actions, there's still just stuff from one layer. That's why the Feature Info Widget doesn't work as a popup replacement.

Assuming that you are trying to build this off of a mouse click, you can use the API functions to do a spatial query. Something like these examples. https://developers.arcgis.com/javascript/latest/sample-code/featurelayerview-query-distance/ https://developers.arcgis.com/javascript/latest/sample-code/featurelayerview-query-geometry/ https://developers.arcgis.com/javascript/latest/sample-code/highlight-features-by-geometry/

With the query results, build your URL and use an iframe. https://www.w3schools.com/html/html_iframe.asp The Embed Widget is really just an iframe.

GIS Developer
City of Arlington, Texas
0 Kudos
jtermaaten
Occasional Contributor

The use case is indeed to open the url based on a mouse click and use the selected feature only. Reading between the lines, I assume there's no current custom widget for this?

I did find a workaround, but it's quite slow. I ended up creating a custom dataset with Arcade that contains all features from the layers that do have a URL to open in the Embed widget. Clicking a feature filters the Arcade dataset and that triggers the Embed widget to open the URL from the remaining feature in the Arcade dataset.
This solution works fine, but it's quite data-intensive. The browser is building this dataset and that can take quite a while when the original layers are large.. Any thoughts on this?

0 Kudos