<?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: Reference a layer in map using Arcade in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/reference-a-layer-in-map-using-arcade/m-p/1527819#M7211</link>
    <description>&lt;P&gt;Where are you trying to use this expression? Referencing other layers with Arcade functions a little differently in ArcGIS Pro compared to the web.&lt;/P&gt;&lt;P&gt;If the DEM polygons are a published service, I'd suggest using &lt;STRONG&gt;FeatureSetByPortalItem&lt;/STRONG&gt; instead, as it will work regardless of whether the layer is present in the map, and works the same in Pro or the web.&lt;/P&gt;</description>
    <pubDate>Tue, 27 Aug 2024 12:55:08 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2024-08-27T12:55:08Z</dc:date>
    <item>
      <title>Reference a layer in map using Arcade</title>
      <link>https://community.esri.com/t5/developers-questions/reference-a-layer-in-map-using-arcade/m-p/1527818#M7210</link>
      <description>&lt;P&gt;I'm trying to write a field calculation expression in Arcade that will populate a value in the field of a point feature using a value from the intersecting polygon from another feature class in the same map. The documentation I've seen shows to reference a layer in the same map using either $map or $layer. I've tried both of the lines below, but neither are working and give me an object not found error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var dem = FeatureSetByName($map, “Elev_Polygons_2023”, “FieldName = ‘gridcode’”);&lt;/P&gt;&lt;P&gt;var dem = FeatureSetByName($layer, “Elev_Polygons_2023”, “FieldName = ‘gridcode’”);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the full expression so far:&lt;/P&gt;&lt;P&gt;// Reference the current device feature&lt;/P&gt;&lt;P&gt;var device = $feature;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Retrieve the DEM polygons feature set&lt;/P&gt;&lt;P&gt;var demFeatures = FeatureSetByName($layer, "Elev_Polygons_2023", ["gridcode"], true);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Find the polygons that intersect with the current device&lt;/P&gt;&lt;P&gt;var intersectingPolygons = Filter(demFeatures, 'Intersects($feature)');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Get the first intersecting polygon&lt;/P&gt;&lt;P&gt;var intersectingPolygon = First(intersectingPolygons);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Extract the gridcode value if an intersecting polygon exists&lt;/P&gt;&lt;P&gt;var elevation = intersectingPolygon["gridcode"];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Return the elevation value&lt;/P&gt;&lt;P&gt;return elevation;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 12:51:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/reference-a-layer-in-map-using-arcade/m-p/1527818#M7210</guid>
      <dc:creator>Justin_CLT</dc:creator>
      <dc:date>2024-08-27T12:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: Reference a layer in map using Arcade</title>
      <link>https://community.esri.com/t5/developers-questions/reference-a-layer-in-map-using-arcade/m-p/1527819#M7211</link>
      <description>&lt;P&gt;Where are you trying to use this expression? Referencing other layers with Arcade functions a little differently in ArcGIS Pro compared to the web.&lt;/P&gt;&lt;P&gt;If the DEM polygons are a published service, I'd suggest using &lt;STRONG&gt;FeatureSetByPortalItem&lt;/STRONG&gt; instead, as it will work regardless of whether the layer is present in the map, and works the same in Pro or the web.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 12:55:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/reference-a-layer-in-map-using-arcade/m-p/1527819#M7211</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-08-27T12:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: Reference a layer in map using Arcade</title>
      <link>https://community.esri.com/t5/developers-questions/reference-a-layer-in-map-using-arcade/m-p/1527821#M7212</link>
      <description>&lt;P&gt;I'm using it in a field calculation in Pro. The Elev_Polygons_2023 feature class is in a file geodatabase.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 12:58:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/reference-a-layer-in-map-using-arcade/m-p/1527821#M7212</guid>
      <dc:creator>Justin_CLT</dc:creator>
      <dc:date>2024-08-27T12:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: Reference a layer in map using Arcade</title>
      <link>https://community.esri.com/t5/developers-questions/reference-a-layer-in-map-using-arcade/m-p/1527836#M7213</link>
      <description>&lt;P&gt;Any chance the layers are in the same geodatabase? You could try using &lt;STRONG&gt;$datastore&lt;/STRONG&gt; in the &lt;STRONG&gt;FeatureSetByName&lt;/STRONG&gt;, rather than $layer or $map.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 13:16:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/reference-a-layer-in-map-using-arcade/m-p/1527836#M7213</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-08-27T13:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: Reference a layer in map using Arcade</title>
      <link>https://community.esri.com/t5/developers-questions/reference-a-layer-in-map-using-arcade/m-p/1527837#M7214</link>
      <description>&lt;P&gt;They are not in the same geodatabase.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 13:21:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/reference-a-layer-in-map-using-arcade/m-p/1527837#M7214</guid>
      <dc:creator>Justin_CLT</dc:creator>
      <dc:date>2024-08-27T13:21:35Z</dc:date>
    </item>
  </channel>
</rss>

