Select to view content in your preferred language

Can I populate a popup with data from a different layer via a lookup?

1722
5
Jump to solution
03-15-2023 05:57 PM
Labels (1)
LindsayRaabe_FPCWA
Honored Contributor

I have a polyogn feature service which I use in a number of ArcGIS Online webmaps/apps and Field Maps. I also have a new table feature service. Both feature services have attributes in common.

Can I edit the popup on my polygon layer to use those common attributes to lookup values from the table? I can't find any examples online where this has been done without a Related Table relationship existing, or a geometric intersection being possible. 

 

Example:

Tap polygon with name "Ferndale" to view popup

Arcade expression in Popup looks up "Ferndale" in the table feature service (also loaded in the map) and returns another attribute such as a document URL. 

 

Lindsay Raabe
GIS Officer
Forest Products Commission WA
1 Solution

Accepted Solutions
ChristopherCounsell
MVP Regular Contributor

You will want to use the FeatureSetByID or FeatureSetByName function. This allows you to call another layer in within the map or feature service. FeatureSetByID is better as it's unique. 

This will return all features from that layer, so you'll want to:

  1. Reduce the fields to only those interested
  2. Reduce the number of features returned. This can be done in your case by using a Filter.

You can find an example of this workflow here under 'Obtain data from a different layer'

https://learn.arcgis.com/en/projects/access-attributes-from-another-layer-with-arcade/

It's also pretty similar to what is done here, but instead of using intersects, you use filters

https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/whats-new-with-arcade-taking-a-strol...

Additional info:

https://developers.arcgis.com/arcade/function-reference/featureset_functions/

https://developers.arcgis.com/arcade/function-reference/featureset_functions/#filter

 

View solution in original post

5 Replies
ChristopherCounsell
MVP Regular Contributor

You will want to use the FeatureSetByID or FeatureSetByName function. This allows you to call another layer in within the map or feature service. FeatureSetByID is better as it's unique. 

This will return all features from that layer, so you'll want to:

  1. Reduce the fields to only those interested
  2. Reduce the number of features returned. This can be done in your case by using a Filter.

You can find an example of this workflow here under 'Obtain data from a different layer'

https://learn.arcgis.com/en/projects/access-attributes-from-another-layer-with-arcade/

It's also pretty similar to what is done here, but instead of using intersects, you use filters

https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/whats-new-with-arcade-taking-a-strol...

Additional info:

https://developers.arcgis.com/arcade/function-reference/featureset_functions/

https://developers.arcgis.com/arcade/function-reference/featureset_functions/#filter

 

LindsayRaabe_FPCWA
Honored Contributor

Thanks! Now to start understanding how it all works! I know what I want, but not only learning more about how Arcade works, but also HTML by the looks of it (if I want to format it as a table)....

Lindsay Raabe
GIS Officer
Forest Products Commission WA
LindsayRaabe_FPCWA
Honored Contributor

I thought I'd let you know that the info in the links you provided has helped me successfully write Arcade codes which return the information I'm looking for in Popups. I was hoping to put these codes into the layers Visualisation settings, and for it to flow through to all maps that the relevant table is also loaded into (or it would return blank if table was absent). But it appears that this type of popup element doesn't seem to like WebAppBuilder apps. The popups are simply blank once implemented (even loses the existing fields list portion of the popup). Will have to dig further, and will also likely break the single Arcade code into chunks that can be returned individually (in a table format maybe?). 

Lindsay Raabe
GIS Officer
Forest Products Commission WA
0 Kudos
ChristopherCounsell
MVP Regular Contributor
Check the function against the JavaScript API version compatibility.

Some stuff is JavaScript 4.x
Meaning you need new map viewer and applications that leverage the 4.x API.
Experience builder. Dashboards. Instant apps.

Web AppBuilder, configurable templates and 'classic' apps use the 3.x API
and won't support the newwr functionalilty, including some Arcade functions

At this stage I'm leaning towards using new map viewer and all new app
templates/designers where possible. Would recommend the same. Give it a
whirl there and let us know, or check the compatibility page.

Some featureset expressions work in classic (I've done intersect with
another layer)
LindsayRaabe_FPCWA
Honored Contributor

Yeah - I figured this would be the case. I have already started trying out Experience Builder with new apps, but the majority we have were built a while back when WebAppBuilder was the main offering. Think we're going to have to schedule an upgrade and migration process - just another thing on the to-do list!

Lindsay Raabe
GIS Officer
Forest Products Commission WA
0 Kudos