<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Create a single popup for multiple layers using Arcade in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/create-a-single-popup-for-multiple-layers-using/m-p/1601767#M64241</link>
    <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1142"&gt;@MikeSweeney&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Great example! Thanks for sharing how it's done, this has been something that I've wanted to work with for quite a bit, but never got to it!&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
    <pubDate>Wed, 02 Apr 2025 12:22:23 GMT</pubDate>
    <dc:creator>CodyPatterson</dc:creator>
    <dc:date>2025-04-02T12:22:23Z</dc:date>
    <item>
      <title>Create a single popup for multiple layers using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/create-a-single-popup-for-multiple-layers-using/m-p/1601341#M64220</link>
      <description>&lt;P&gt;I was recently asked how to use Arcade to generate a single popup for multiple layers, rather than having to &lt;EM&gt;page through multiple popups (one per layer).&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Here is how I did that.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;I began by creating a map with the ZIP Codes, Census Tracts and State boundaries:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeSweeney_23-1743521159911.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/129151i58F816E901BBD6AF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeSweeney_23-1743521159911.png" alt="MikeSweeney_23-1743521159911.png" /&gt;&lt;/span&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;By default, when I click on a location on the map, the Map Viewer will display a single popup window, with an arrow to page through all of the layers:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeSweeney_26-1743521259469.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/129152iB7F0474BA0588262/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeSweeney_26-1743521259469.png" alt="MikeSweeney_26-1743521259469.png" /&gt;&lt;/span&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeSweeney_27-1743521268728.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/129153iAB1BD7C8F45A37F4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeSweeney_27-1743521268728.png" alt="MikeSweeney_27-1743521268728.png" /&gt;&lt;/span&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeSweeney_28-1743521282017.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/129154i241327FAF61A5DFF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeSweeney_28-1743521282017.png" alt="MikeSweeney_28-1743521282017.png" /&gt;&lt;/span&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;What if you want a single popup window displaying information from each of the layers, with no need to page through the layers popup windows as above.&amp;nbsp; Something like this?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeSweeney_29-1743521348783.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/129155i321AC0A21C73D1B1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeSweeney_29-1743521348783.png" alt="MikeSweeney_29-1743521348783.png" /&gt;&lt;/span&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;That can be done using Arcade.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;To begin with, In the web map I DISABLED popups for the County and State layers.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeSweeney_30-1743521443305.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/129156i0687E5E9B611396E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeSweeney_30-1743521443305.png" alt="MikeSweeney_30-1743521443305.png" /&gt;&lt;/span&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeSweeney_31-1743521449351.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/129157i5F651DFF6AEF006A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeSweeney_31-1743521449351.png" alt="MikeSweeney_31-1743521449351.png" /&gt;&lt;/span&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;I ENABLED the popups for the ZIP Codes layer.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeSweeney_32-1743521455464.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/129158iFD2887946E759D85/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeSweeney_32-1743521455464.png" alt="MikeSweeney_32-1743521455464.png" /&gt;&lt;/span&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;I then added an attribute expression to specify the Arcade code to be run when I click on the map.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeSweeney_33-1743521509088.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/129159iDFE453A939498384/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeSweeney_33-1743521509088.png" alt="MikeSweeney_33-1743521509088.png" /&gt;&lt;/span&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;I named the Arcade expression "&lt;STRONG&gt;ZIP Code, County, State&lt;/STRONG&gt;"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeSweeney_34-1743521517026.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/129160i541391362155003E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeSweeney_34-1743521517026.png" alt="MikeSweeney_34-1743521517026.png" /&gt;&lt;/span&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;I wrote this code in the expression window&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeSweeney_35-1743521616808.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/129161iF51D53BFE6CA505B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeSweeney_35-1743521616808.png" alt="MikeSweeney_35-1743521616808.png" /&gt;&lt;/span&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;This code does the following:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;First, get the &lt;STRONG&gt;FeatureSet&lt;/STRONG&gt; for the states, counties and zip codes layers&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;A href="https://developers.arcgis.com/arcade/guide/types/#featureset" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/arcade/guide/types/#featureset&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;A href="https://developers.arcgis.com/arcade/function-reference/featureset_functions/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/arcade/function-reference/featureset_functions/&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;var states = FeatureSetByName($map, "USA Census States", ["STATE_NAME"], false)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;var counties = FeatureSetByName($map, "USA Census Counties", ["NAME"], false)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;var zips = FeatureSetByName($map, "United States ZIP Code Boundaries", ["ZIP_CODE"], false)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Next, we want to use the location where you clicked on the map ( &lt;STRONG&gt;$userInput&lt;/STRONG&gt; ) to find the intersecting state, county, and zip code&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeSweeney_37-1743521714978.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/129162i4B7D73FFF48A9628/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeSweeney_37-1743521714978.png" alt="MikeSweeney_37-1743521714978.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;A href="https://developers.arcgis.com/arcade/profiles/popup/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/arcade/profiles/popup/&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;var state = Intersects(states, $userInput)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;var county = Intersects(counties, $userInput)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;var zip = Intersects(zips, $userInput)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, we want to pull the values for the fields we are looking for and assign them to variables.&amp;nbsp; So we get the first record (there should only be one) and extract the field value we want&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/arcade/function-reference/array_functions/#first" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/arcade/function-reference/array_functions/#first&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;var stateName = first(state).STATE_NAME&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;var countyName = first(county).NAME&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;var zipName = first(zip).ZIP_CODE&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then finally we build an array &lt;STRONG&gt;[var, var, var]&lt;/STRONG&gt; of the variables and pass it back to the attribute expression&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;Return [zipName, countyName, stateName]&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the ZIP Code layer popup we use the Fields List to add the attribute expression to the list of fields to be displayed&lt;/P&gt;&lt;P&gt;Click&amp;nbsp; &lt;FONT color="#000000"&gt;&lt;STRONG&gt;Select Fields &lt;/STRONG&gt;and add the&lt;STRONG&gt; ZIP Code, County, State &lt;/STRONG&gt;attribute expression to the fields to be displayed&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeSweeney_41-1743522135270.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/129165i3DF97E1528D2CDF6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeSweeney_41-1743522135270.png" alt="MikeSweeney_41-1743522135270.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Once you have saved your changes, you should see this for the map popup when you click on the map.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeSweeney_42-1743522232216.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/129166iE6C0B56310C771E7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeSweeney_42-1743522232216.png" alt="MikeSweeney_42-1743522232216.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You could also turn off other fields you don’t want to show and change th title to something meaningful&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeSweeney_43-1743522261017.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/129167iD20970D8FAEAE37B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeSweeney_43-1743522261017.png" alt="MikeSweeney_43-1743522261017.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeSweeney_44-1743522276910.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/129168iFC06DC59137BA85B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeSweeney_44-1743522276910.png" alt="MikeSweeney_44-1743522276910.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can do additional formatting to control the look and feel of the popup.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to play with the web map with this popup configured, you can find it here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://arcgis.com/apps/mapviewer/index.html?webmap=3d2f9e31e1d44ab8bf41b19465bb5507" target="_blank" rel="noopener"&gt;https://arcgis.com/apps/mapviewer/index.html?webmap=3d2f9e31e1d44ab8bf41b19465bb5507&lt;/A&gt;&lt;/P&gt;&lt;P&gt;In addition, I created an Instant App using the Basic viewer and you can check that out here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://arcgis.com/apps/instant/basic/index.html?appid=8719093f943242b2a885513a43def915" target="_blank" rel="noopener"&gt;https://arcgis.com/apps/instant/basic/index.html?appid=8719093f943242b2a885513a43def915&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2025 15:46:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/create-a-single-popup-for-multiple-layers-using/m-p/1601341#M64220</guid>
      <dc:creator>MikeSweeney</dc:creator>
      <dc:date>2025-04-01T15:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: Create a single popup for multiple layers using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/create-a-single-popup-for-multiple-layers-using/m-p/1601767#M64241</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1142"&gt;@MikeSweeney&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Great example! Thanks for sharing how it's done, this has been something that I've wanted to work with for quite a bit, but never got to it!&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
      <pubDate>Wed, 02 Apr 2025 12:22:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/create-a-single-popup-for-multiple-layers-using/m-p/1601767#M64241</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2025-04-02T12:22:23Z</dc:date>
    </item>
  </channel>
</rss>

