<?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: Using Arcade in Popup to display fields from 2 different layers in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-in-popup-to-display-fields-from-2/m-p/1142134#M44249</link>
    <description>&lt;P&gt;Spatial operations in Arcade are dependent on the view scale, so it's possible that the features don't end up intersecting because of the map generalizing your features.&lt;/P&gt;&lt;P&gt;What if you tried something like buffering the feature?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;First(Intersects(Buffer($feature, 10), fac))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That might catch more points than intended, but could indicate whether or not it's the intersection doing something different in the map view.&lt;/P&gt;</description>
    <pubDate>Wed, 09 Feb 2022 15:33:49 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2022-02-09T15:33:49Z</dc:date>
    <item>
      <title>Using Arcade in Popup to display fields from 2 different layers</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-in-popup-to-display-fields-from-2/m-p/1141636#M44203</link>
      <description>&lt;P&gt;I'm trying to use Arcade to display table information in a Popup from 2 different layers in the same map.&lt;/P&gt;&lt;P&gt;Both layers are point features, same geospatial locations but different attribute data.&lt;/P&gt;&lt;P&gt;The main layer (which generates the Popup) uses a standard field list to display attributes and it works. I created an Arcade expression (using the fields template) to bring in the attributes from the secondary layer (using the &lt;A href="https://developers.arcgis.com/arcade/function-reference/geometry_functions/#intersects" target="_self"&gt;&lt;EM&gt;Intersect&lt;/EM&gt;&lt;/A&gt; arcade expression to select features from the secondary layer).&lt;/P&gt;&lt;P&gt;However, even though I get a second fields list the attributes are populated with:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RandyMcGraw1_1-1644335139766.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33355i0E968ABD318CBD47/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RandyMcGraw1_1-1644335139766.png" alt="RandyMcGraw1_1-1644335139766.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Arcade Expression:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;// Facilities - Construction Year&lt;BR /&gt;var fac = FeatureSetByName($map,"Facilities",['Construction_Year'])&lt;/P&gt;&lt;P&gt;//Get Intersecting features&lt;BR /&gt;var intfac = Intersects($feature, fac)&lt;/P&gt;&lt;P&gt;// Facilities - Structure_Number&lt;BR /&gt;var str = FeatureSetByName($map,"Facilities",['Structure_Number'])&lt;/P&gt;&lt;P&gt;//Get Intersecting features&lt;BR /&gt;var intstr = Intersects($feature, str)&lt;/P&gt;&lt;P&gt;// Facilities - Floar area&lt;BR /&gt;var flo = FeatureSetByName($map,"Facilities",['Floor_Area'])&lt;/P&gt;&lt;P&gt;//Get Intersecting features&lt;BR /&gt;var intflo = Intersects($feature, flo)&lt;/P&gt;&lt;P&gt;return {&lt;BR /&gt;type: 'fields',&lt;BR /&gt;//title: '',&lt;BR /&gt;//description : '',&lt;BR /&gt;fieldInfos: [{&lt;BR /&gt;fieldName: "Construction"&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;fieldName: "Structure"&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;fieldName: "Floor"&lt;BR /&gt;}],&lt;BR /&gt;attributes : {Construction : intfac, Structure : intstr, Floor : intflo}&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thank you for any help you can provide&lt;/P&gt;&lt;P&gt;Randy&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 16:05:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-in-popup-to-display-fields-from-2/m-p/1141636#M44203</guid>
      <dc:creator>RandyMcGraw1</dc:creator>
      <dc:date>2022-02-08T16:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade in Popup to display fields from 2 different layers</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-in-popup-to-display-fields-from-2/m-p/1141654#M44205</link>
      <description>&lt;P&gt;When you use &lt;STRONG&gt;Intersect&lt;/STRONG&gt;, the returned object is still a &lt;STRONG&gt;FeatureSet&lt;/STRONG&gt;. You need to access a single &lt;STRONG&gt;Feature&lt;/STRONG&gt; object in order to pull out its attributes. The simplest method is to use &lt;STRONG&gt;First&lt;/STRONG&gt;, and as long as your points will not intersect with multiple features, you can use this expression:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fac_fields = [
    'Construction_Year',
    'Structure_Number',
    'Floor_Area'
]

var fac = FeatureSetByName($map, "Facilities", fac_fields, true)

var intfac = First(Intersects($feature, fac))

return `Construction: ${intfac['Construction_Year']}
Structure: ${intfac['Structure_Number']}
Floor: ${intfac['Floor_Area']}`&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 15:07:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-in-popup-to-display-fields-from-2/m-p/1141654#M44205</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-02-09T15:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade in Popup to display fields from 2 different layers</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-in-popup-to-display-fields-from-2/m-p/1141798#M44221</link>
      <description>&lt;P&gt;Hello Josh,&lt;/P&gt;&lt;P&gt;Your expressions works for me in the expression builder:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RandyMcGraw1_0-1644352731616.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33386i6255AF21561F0D70/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RandyMcGraw1_0-1644352731616.png" alt="RandyMcGraw1_0-1644352731616.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But it is not showing up in the actual Popup. Any ideas of how to fix this?&lt;BR /&gt;&lt;BR /&gt;Your help is greatly appreciated.&lt;/P&gt;&lt;P&gt;Randy&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 20:48:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-in-popup-to-display-fields-from-2/m-p/1141798#M44221</guid>
      <dc:creator>RandyMcGraw1</dc:creator>
      <dc:date>2022-02-08T20:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade in Popup to display fields from 2 different layers</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-in-popup-to-display-fields-from-2/m-p/1141803#M44222</link>
      <description>&lt;P&gt;Have you tested the popup on multiple features? If there are no intersecting features, it's going to run into null values and not return anything.&lt;/P&gt;&lt;P&gt;We can try adding some null handling to the expression itself, too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fac_fields = [
    'Construction_Year',
    'Structure_Number',
    'Floor_Area'
]

var fac = FeatureSetByName($map, "Facilities", fac_fields, true)

var intfac = First(Intersects($feature, fac))

If(IsEmpty(intfac)){
    return 'No intersecting feature'
} Else {
    return `Construction: ${intfac['Construction_Year']}
    Structure: ${intfac['Structure_Number']}
    Floor: ${intfac['Floor_Area']}`
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 15:06:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-in-popup-to-display-fields-from-2/m-p/1141803#M44222</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-02-09T15:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade in Popup to display fields from 2 different layers</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-in-popup-to-display-fields-from-2/m-p/1142096#M44245</link>
      <description>&lt;P&gt;Hello Josh,&lt;/P&gt;&lt;P&gt;First of all, thanks for taking the time to help.&lt;/P&gt;&lt;P&gt;Unfortunately the "If" statements has not fixed the situation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it normal that your when I use your expression I get a "&amp;nbsp;&lt;SPAN class=""&gt;Execution Error:&lt;/SPAN&gt;&lt;SPAN&gt;Cannot assign undeclared variable"?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RandyMcGraw1_0-1644417733514.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33483i7B93741EEA9D0229/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RandyMcGraw1_0-1644417733514.png" alt="RandyMcGraw1_0-1644417733514.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When I add a variable statement in front of the "fac_fields" the test runs smoothly:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RandyMcGraw1_1-1644417845834.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33484i8EA4DDF68A113AD3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RandyMcGraw1_1-1644417845834.png" alt="RandyMcGraw1_1-1644417845834.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Could that be the issue?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 14:46:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-in-popup-to-display-fields-from-2/m-p/1142096#M44245</guid>
      <dc:creator>RandyMcGraw1</dc:creator>
      <dc:date>2022-02-09T14:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade in Popup to display fields from 2 different layers</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-in-popup-to-display-fields-from-2/m-p/1142114#M44246</link>
      <description>&lt;P&gt;Oh gosh, foolish mistake on my part. Yes, the &lt;STRONG&gt;fac_fields &lt;/STRONG&gt;needs a "var" in front of it. I'll fix the original post. Also, I didn't realize the output string would insert the line indentations like that, so I've adjusted that as well.&lt;/P&gt;&lt;P&gt;I'm still not certain why the expression doesn't return anything in the map. Other expressions seem to share this behavior, but I've not found a common cause for why it happens.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 15:06:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-in-popup-to-display-fields-from-2/m-p/1142114#M44246</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-02-09T15:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade in Popup to display fields from 2 different layers</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-in-popup-to-display-fields-from-2/m-p/1142130#M44248</link>
      <description>&lt;P&gt;I agree with you that all seems to be order with the expression and it seems to be a behavioral issue between the expression and the popup. I'm going to contact my Admin and see if we can't find a fix.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 15:29:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-in-popup-to-display-fields-from-2/m-p/1142130#M44248</guid>
      <dc:creator>RandyMcGraw1</dc:creator>
      <dc:date>2022-02-09T15:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade in Popup to display fields from 2 different layers</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-in-popup-to-display-fields-from-2/m-p/1142134#M44249</link>
      <description>&lt;P&gt;Spatial operations in Arcade are dependent on the view scale, so it's possible that the features don't end up intersecting because of the map generalizing your features.&lt;/P&gt;&lt;P&gt;What if you tried something like buffering the feature?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;First(Intersects(Buffer($feature, 10), fac))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That might catch more points than intended, but could indicate whether or not it's the intersection doing something different in the map view.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 15:33:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-in-popup-to-display-fields-from-2/m-p/1142134#M44249</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-02-09T15:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade in Popup to display fields from 2 different layers</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-in-popup-to-display-fields-from-2/m-p/1142208#M44258</link>
      <description>&lt;P&gt;I tried the buffer and still nothing. When I activate a Popup on both layers, they both show up in the Popup window.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 17:11:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-in-popup-to-display-fields-from-2/m-p/1142208#M44258</guid>
      <dc:creator>RandyMcGraw1</dc:creator>
      <dc:date>2022-02-09T17:11:17Z</dc:date>
    </item>
  </channel>
</rss>

