<?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: How to update values in an external feature class by join in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/how-to-update-values-in-an-external-feature-class/m-p/1240960#M684</link>
    <description>&lt;P&gt;You can get related features with &lt;A href="https://developers.arcgis.com/arcade/function-reference/featureset_functions/#featuresetbyrelationshipname" target="_blank" rel="noopener"&gt;FeaturesetByRelationshipName()&lt;/A&gt; or &lt;A href="https://developers.arcgis.com/arcade/function-reference/featureset_functions/#filter" target="_blank" rel="noopener"&gt;Filter()&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;To update another table, you have to return a dictionary with specific keys:&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-keywords.htm" target="_blank" rel="noopener"&gt;Attribute rule dictionary keywords—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Calculation Attribute Rule on inspection table
// field: empty
// triggers: Insert, Update

// load the hydrants
var hydrant_fs = FeaturesetByName(...)

// filter for the hydrant this inspection belongs to
var asset_id = $feature.asset_id
var hydrant = First(Filter(hydrant_fs, "asset_id = @asset_id"))

// if no corresponding hydrant is found, abort
if(hydrant == null) { return }

// else update the hydrant
return {
    edit: [{
        className: "HydrantFC", // full name of the hydrant fc
        updates: [{
            objectID: hydrant.OBJECTID,
            attributes: {
                recent_condition_rating: $feature.condition_rating
                recent_inspection_date: $feature.inspection_date
            }
        }]
    }]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Dec 2022 06:36:15 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2022-12-14T06:36:15Z</dc:date>
    <item>
      <title>How to update values in an external feature class by join</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/how-to-update-values-in-an-external-feature-class/m-p/1240791#M683</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm new to attribute rules and I'm trying to figure out how to build a calculation attribute rule to update a couple fields in an external feature class based on values in a related table.&lt;/P&gt;&lt;P&gt;I have a Hydrant FC and a Hydrant Inspection table.&amp;nbsp; These are related by way of a relationship class with an asset_id.&amp;nbsp; When a user creates a new inspection or updates an existing inspection for a particular asset_id, I would like the system to take the condition_rating and inspection_date and update the corresponding recent_condition_rating and recent_inspection_date fields in the Hydrant FC for the same asset_id.&lt;/P&gt;&lt;P&gt;I have seen examples of updating an external FC's field via attribute rules using intersect, but I can't figure out how to do similar using non-spatial means.&lt;/P&gt;&lt;P&gt;Any help would be very much appreciated.&amp;nbsp; Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 01:04:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/how-to-update-values-in-an-external-feature-class/m-p/1240791#M683</guid>
      <dc:creator>AndrewKan</dc:creator>
      <dc:date>2022-12-14T01:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to update values in an external feature class by join</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/how-to-update-values-in-an-external-feature-class/m-p/1240960#M684</link>
      <description>&lt;P&gt;You can get related features with &lt;A href="https://developers.arcgis.com/arcade/function-reference/featureset_functions/#featuresetbyrelationshipname" target="_blank" rel="noopener"&gt;FeaturesetByRelationshipName()&lt;/A&gt; or &lt;A href="https://developers.arcgis.com/arcade/function-reference/featureset_functions/#filter" target="_blank" rel="noopener"&gt;Filter()&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;To update another table, you have to return a dictionary with specific keys:&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-keywords.htm" target="_blank" rel="noopener"&gt;Attribute rule dictionary keywords—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Calculation Attribute Rule on inspection table
// field: empty
// triggers: Insert, Update

// load the hydrants
var hydrant_fs = FeaturesetByName(...)

// filter for the hydrant this inspection belongs to
var asset_id = $feature.asset_id
var hydrant = First(Filter(hydrant_fs, "asset_id = @asset_id"))

// if no corresponding hydrant is found, abort
if(hydrant == null) { return }

// else update the hydrant
return {
    edit: [{
        className: "HydrantFC", // full name of the hydrant fc
        updates: [{
            objectID: hydrant.OBJECTID,
            attributes: {
                recent_condition_rating: $feature.condition_rating
                recent_inspection_date: $feature.inspection_date
            }
        }]
    }]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 06:36:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/how-to-update-values-in-an-external-feature-class/m-p/1240960#M684</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-12-14T06:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to update values in an external feature class by join</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/how-to-update-values-in-an-external-feature-class/m-p/1242158#M691</link>
      <description>&lt;P&gt;Thanks so much Johannes!&amp;nbsp; I appreciate the help!&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2022 21:42:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/how-to-update-values-in-an-external-feature-class/m-p/1242158#M691</guid>
      <dc:creator>AndrewKan</dc:creator>
      <dc:date>2022-12-16T21:42:52Z</dc:date>
    </item>
  </channel>
</rss>

