<?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 Arcade auto populating data field based on intersecting other layer in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-auto-populating-data-field-based-on/m-p/1196359#M47128</link>
    <description>&lt;P&gt;Hello - I am looking for a way to auto populate a Project name on a line feature based on if the field operations crew draws that line within a certain polygon.&lt;/P&gt;&lt;P&gt;The polygon serves as a boundary and has the field "Project" and is populated with the area's Project name. When the field crew adds a new polyline, I want the polyline's "Project" field to auto populate with the polygon's pre-populated "Project"&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to Arcade, kind of thrown into learning all of this on the spot on active projects. I'm pretty lost.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-enterprise-questions/use-arcade-to-populate-fields-from-other-layers/td-p/1082858" target="_blank" rel="noopener"&gt;I've tried this code verbatim&lt;/A&gt;&amp;nbsp;and I'm not understanding the error message of 'cannot call member method on null'&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KWilliams_0-1658933711347.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/46918i5D88793456CCE8A3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KWilliams_0-1658933711347.png" alt="KWilliams_0-1658933711347.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jul 2022 14:57:55 GMT</pubDate>
    <dc:creator>KWilliams</dc:creator>
    <dc:date>2022-07-27T14:57:55Z</dc:date>
    <item>
      <title>Arcade auto populating data field based on intersecting other layer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-auto-populating-data-field-based-on/m-p/1196359#M47128</link>
      <description>&lt;P&gt;Hello - I am looking for a way to auto populate a Project name on a line feature based on if the field operations crew draws that line within a certain polygon.&lt;/P&gt;&lt;P&gt;The polygon serves as a boundary and has the field "Project" and is populated with the area's Project name. When the field crew adds a new polyline, I want the polyline's "Project" field to auto populate with the polygon's pre-populated "Project"&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to Arcade, kind of thrown into learning all of this on the spot on active projects. I'm pretty lost.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-enterprise-questions/use-arcade-to-populate-fields-from-other-layers/td-p/1082858" target="_blank" rel="noopener"&gt;I've tried this code verbatim&lt;/A&gt;&amp;nbsp;and I'm not understanding the error message of 'cannot call member method on null'&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KWilliams_0-1658933711347.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/46918i5D88793456CCE8A3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KWilliams_0-1658933711347.png" alt="KWilliams_0-1658933711347.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 14:57:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-auto-populating-data-field-based-on/m-p/1196359#M47128</guid>
      <dc:creator>KWilliams</dc:creator>
      <dc:date>2022-07-27T14:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade auto populating data field based on intersecting other layer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-auto-populating-data-field-based-on/m-p/1196421#M47131</link>
      <description>&lt;P&gt;When validating your expression, Arcade will return empty FeatureSets with functions like Intersects().&lt;/P&gt;&lt;P&gt;Calling First() on an empty FeatureSet returns null.&lt;/P&gt;&lt;P&gt;So xs_feat is null, thus you can't call a member method on null.&lt;/P&gt;&lt;P&gt;You have to check for null before you continue:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var other_layer = ...
var xs_feat = First(Intersects($feature, other_layer))
if(xs_feat == null) { return "Some default value" }
return xs_feat.Project&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 16:16:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-auto-populating-data-field-based-on/m-p/1196421#M47131</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-07-27T16:16:00Z</dc:date>
    </item>
  </channel>
</rss>

