<?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 Not Saving - Calculation in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/attribute-rule-not-saving-calculation/m-p/1222068#M7950</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have two layers, one with parcels ("COPY_BaseParcel") and one with buildings ("COPY_BuildingsNew"). Currently there is a field in COPY_BaseParcel named "GPin" which has a unique GPIN ID number for every parcel.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this code to try to see which parcel each building intersects with and add the corresponding "GPin" from the parcel layer to the building layer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;There must be some kind of error with my code, as ArcGIS Pro will not let me save the attribute rule.&lt;/P&gt;&lt;P&gt;Please help me figure it out!&lt;/P&gt;&lt;P&gt;---&lt;/P&gt;&lt;P&gt;var fsParcel = FeatureSetByName($datastore, "COPY_BaseParcel", ["GPin"])&lt;BR /&gt;var fsIntersectParcel = Intersects($feature, fsParcel)&lt;BR /&gt;var GPin = First(fsIntersectParcel)&lt;BR /&gt;if(fsParcel == null) return null&lt;BR /&gt;else return GPin.GPin&lt;/P&gt;</description>
    <pubDate>Fri, 14 Oct 2022 14:59:34 GMT</pubDate>
    <dc:creator>CaraDavis</dc:creator>
    <dc:date>2022-10-14T14:59:34Z</dc:date>
    <item>
      <title>Attribute Rule Not Saving - Calculation</title>
      <link>https://community.esri.com/t5/geodatabase-questions/attribute-rule-not-saving-calculation/m-p/1222068#M7950</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have two layers, one with parcels ("COPY_BaseParcel") and one with buildings ("COPY_BuildingsNew"). Currently there is a field in COPY_BaseParcel named "GPin" which has a unique GPIN ID number for every parcel.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this code to try to see which parcel each building intersects with and add the corresponding "GPin" from the parcel layer to the building layer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;There must be some kind of error with my code, as ArcGIS Pro will not let me save the attribute rule.&lt;/P&gt;&lt;P&gt;Please help me figure it out!&lt;/P&gt;&lt;P&gt;---&lt;/P&gt;&lt;P&gt;var fsParcel = FeatureSetByName($datastore, "COPY_BaseParcel", ["GPin"])&lt;BR /&gt;var fsIntersectParcel = Intersects($feature, fsParcel)&lt;BR /&gt;var GPin = First(fsIntersectParcel)&lt;BR /&gt;if(fsParcel == null) return null&lt;BR /&gt;else return GPin.GPin&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 14:59:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/attribute-rule-not-saving-calculation/m-p/1222068#M7950</guid>
      <dc:creator>CaraDavis</dc:creator>
      <dc:date>2022-10-14T14:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule Not Saving - Calculation</title>
      <link>https://community.esri.com/t5/geodatabase-questions/attribute-rule-not-saving-calculation/m-p/1222416#M7952</link>
      <description>&lt;P&gt;You are checking fsParcel for null, but you need to check GPin.&lt;/P&gt;&lt;P&gt;The reason for this check: Intersects() returns an empty Featureset when there are no intersecting features. Calling First() on an empty Featureset returns null. Trying to call a field on null will give an error.&lt;/P&gt;&lt;P&gt;So, try this expression:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fsParcel = FeatureSetByName($datastore, "COPY_BaseParcel", ["GPin"])
var fsIntersectParcel = Intersects($feature, fsParcel)
var GPin = First(fsIntersectParcel)
if(GPin == null) return null
return GPin.GPin&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 17 Oct 2022 08:34:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/attribute-rule-not-saving-calculation/m-p/1222416#M7952</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-10-17T08:34:08Z</dc:date>
    </item>
  </channel>
</rss>

