<?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 Attribute rule creates unexpected Nulls in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/attribute-rule-creates-unexpected-nulls/m-p/1345156#M27025</link>
    <description>&lt;P&gt;I have a MGDB with a point layer that contains landslides and a polygon layer containing watershed boundaries. I have been trying to create an attribute rule that automatically populates the field "Watershed1" in the point layer "main.terrain_disturbances" using a field of the same name&amp;nbsp;"Watershed1" in the polygon layer "main.NNDTT_watersheds".&lt;/P&gt;&lt;P&gt;Following &lt;A href="https://community.esri.com/t5/geoprocessing-questions/using-attribute-rules-to-calculate-fields-from/td-p/1032944" target="_self"&gt;this example&lt;/A&gt;, which I thought tried to achieve the same thing, I wrote the following Arcade expression"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// Calculation Attribute Rule

// load the Areas poylgon class
var Watershed1 = FeatureSetByName($datastore,"NNDTT_watersheds",["Watershed1"], true)

// intersect the areas with the inserted/edited feature
var intersectLayer = Intersects(Watershed1, Geometry($feature))

if (Count(intersectLayer) &amp;gt; 0) {
    var layer = First(intersectLayer);
    return layer.Watershed1;    
} else {
    return null;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I save the rule my Watershed1 field is still &amp;lt;Null&amp;gt; for all features and when I try to create a new feature it gives me the following error:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Failed to create RTS.&lt;BR /&gt;Failed to evaluate Arcade expression. [&lt;BR /&gt;Rule name: Get watershed1,&lt;BR /&gt;Triggering event: Insert,&lt;BR /&gt;Class name: main.terrain_disturbances,&lt;BR /&gt;GlobalID: {2F371CB9-EB68-498B-887F-2A59C2FA06BE},&lt;BR /&gt;Arcade error: Unexpected null,&lt;BR /&gt;Script line: 11]&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Any help would be appreciated, this is my first attribute rule, thanks!&lt;/P&gt;</description>
    <pubDate>Thu, 02 Nov 2023 18:12:27 GMT</pubDate>
    <dc:creator>FredericBrieger1</dc:creator>
    <dc:date>2023-11-02T18:12:27Z</dc:date>
    <item>
      <title>Attribute rule creates unexpected Nulls</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/attribute-rule-creates-unexpected-nulls/m-p/1345156#M27025</link>
      <description>&lt;P&gt;I have a MGDB with a point layer that contains landslides and a polygon layer containing watershed boundaries. I have been trying to create an attribute rule that automatically populates the field "Watershed1" in the point layer "main.terrain_disturbances" using a field of the same name&amp;nbsp;"Watershed1" in the polygon layer "main.NNDTT_watersheds".&lt;/P&gt;&lt;P&gt;Following &lt;A href="https://community.esri.com/t5/geoprocessing-questions/using-attribute-rules-to-calculate-fields-from/td-p/1032944" target="_self"&gt;this example&lt;/A&gt;, which I thought tried to achieve the same thing, I wrote the following Arcade expression"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// Calculation Attribute Rule

// load the Areas poylgon class
var Watershed1 = FeatureSetByName($datastore,"NNDTT_watersheds",["Watershed1"], true)

// intersect the areas with the inserted/edited feature
var intersectLayer = Intersects(Watershed1, Geometry($feature))

if (Count(intersectLayer) &amp;gt; 0) {
    var layer = First(intersectLayer);
    return layer.Watershed1;    
} else {
    return null;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I save the rule my Watershed1 field is still &amp;lt;Null&amp;gt; for all features and when I try to create a new feature it gives me the following error:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Failed to create RTS.&lt;BR /&gt;Failed to evaluate Arcade expression. [&lt;BR /&gt;Rule name: Get watershed1,&lt;BR /&gt;Triggering event: Insert,&lt;BR /&gt;Class name: main.terrain_disturbances,&lt;BR /&gt;GlobalID: {2F371CB9-EB68-498B-887F-2A59C2FA06BE},&lt;BR /&gt;Arcade error: Unexpected null,&lt;BR /&gt;Script line: 11]&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Any help would be appreciated, this is my first attribute rule, thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2023 18:12:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/attribute-rule-creates-unexpected-nulls/m-p/1345156#M27025</guid>
      <dc:creator>FredericBrieger1</dc:creator>
      <dc:date>2023-11-02T18:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule creates unexpected Nulls</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/attribute-rule-creates-unexpected-nulls/m-p/1367930#M27119</link>
      <description>&lt;P&gt;ESRI, any help on this? Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2024 16:51:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/attribute-rule-creates-unexpected-nulls/m-p/1367930#M27119</guid>
      <dc:creator>FredericBrieger1</dc:creator>
      <dc:date>2024-01-09T16:51:56Z</dc:date>
    </item>
  </channel>
</rss>

