<?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: Attribute Rule: What am I doing wrong? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-what-am-i-doing-wrong/m-p/374477#M16477</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That was the first thing I tried...exported everything to a FGDB, same result. Both datasets have same projection.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jan 2020 18:06:36 GMT</pubDate>
    <dc:creator>ThomasColson</dc:creator>
    <dc:date>2020-01-16T18:06:36Z</dc:date>
    <item>
      <title>Attribute Rule: What am I doing wrong?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-what-am-i-doing-wrong/m-p/374475#M16475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From&amp;nbsp;&lt;A class="link-titled" href="https://github.com/Esri/arcade-expressions/blob/master/attribute_rules_calculation/CopyValueIntersectingFeature.md" title="https://github.com/Esri/arcade-expressions/blob/master/attribute_rules_calculation/CopyValueIntersectingFeature.md" rel="nofollow noopener noreferrer" target="_blank"&gt;arcade-expressions/CopyValueIntersectingFeature.md at master · Esri/arcade-expressions · GitHub&lt;/A&gt;&amp;nbsp;, I have&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;// This rule will populate the edited features field with a value from an intersecting feature&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// Value to copy from the intersected feature&lt;/SPAN&gt;
var intersecting_field &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"GRTS_ID"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;//Field rule is assigned to in the Attribute Rule&lt;/SPAN&gt;
var feature_field &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"GRTS_ID"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// Create feature set to the intersecting class using the GDB Name&lt;/SPAN&gt;
var intersecting_featset &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;FeatureSetByName&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$datastore&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'NABAT_CONUS_10x10_KM_GRID_CELLS_PRJ'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;intersecting_field&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;true&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// Intersect the edited feature with the feature set and retrieve the first feature&lt;/SPAN&gt;
var intersected_feature &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;First&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Intersects&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;intersecting_featset&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; $feature&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// Check to make sure there was an intersected feature, if not, return the original value&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;intersected_feature &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; null&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; $feature&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;feature_field&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// If the intersected feature is null, return the original value&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;IsEmpty&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;intersected_feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GRTS_ID&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; $feature&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;feature_field&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// Return the intersected features value&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; intersected_feature&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;intersecting_field&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/478599_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where&amp;nbsp;NABAT_CONUS_10x10_KM_GRID_CELLS_PRJ is a polygon feature class with the field&amp;nbsp;GRTS_ID (Type Long) and the field I'm wanting to edit in the source feature class is also&amp;nbsp;&lt;SPAN&gt;GRTS_ID (Type Long).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What is happening though is on insert and update, the GRTS_ID field in the feature class being edit instead gets the ObjectID of the intersecting Polygon. 100% sure I've gotten something wrong here.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:20:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-what-am-i-doing-wrong/m-p/374475#M16475</guid>
      <dc:creator>ThomasColson</dc:creator>
      <dc:date>2021-12-11T17:20:13Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule: What am I doing wrong?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-what-am-i-doing-wrong/m-p/374476#M16476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I created some dummy data with your&amp;nbsp;layer/attribute names&amp;nbsp;and created an attribute rule using the exact code you pasted. The 'GRTS_ID' attribute from the 'NABAT_CONUS_10x10_KM_GRID_CELLS_PRJ' layer was&amp;nbsp;copied as expected instead of the Object ID so I don't think your code is wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe try deleting the rule that's giving you trouble, restarting Pro, and creating the rule again? Or you could export a copy of the two datasets and create the rule using the copied layers to see if it's a quirk with the original feature layer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2020 17:59:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-what-am-i-doing-wrong/m-p/374476#M16476</guid>
      <dc:creator>KellyKoenig</dc:creator>
      <dc:date>2020-01-16T17:59:39Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule: What am I doing wrong?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-what-am-i-doing-wrong/m-p/374477#M16477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That was the first thing I tried...exported everything to a FGDB, same result. Both datasets have same projection.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2020 18:06:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-what-am-i-doing-wrong/m-p/374477#M16477</guid>
      <dc:creator>ThomasColson</dc:creator>
      <dc:date>2020-01-16T18:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule: What am I doing wrong?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-what-am-i-doing-wrong/m-p/374478#M16478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmm. Maybe create a new FGDB with two new feature layers and import the field map schema from the original feature layers. Copy a handful of&amp;nbsp;records from each original feature layer and paste them into the new feature layers (or create dummy polygon features that you fill in with a random "GRTS_ID'), then create the rule again. That would be a truer "clean slate" approach than exporting copies of the feature layers themselves.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2020 18:35:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-what-am-i-doing-wrong/m-p/374478#M16478</guid>
      <dc:creator>KellyKoenig</dc:creator>
      <dc:date>2020-01-16T18:35:05Z</dc:date>
    </item>
  </channel>
</rss>

