<?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 Copy value from related record to parent feature via Arcade rule in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/copy-value-from-related-record-to-parent-feature/m-p/1329588#M73165</link>
    <description>&lt;P&gt;Hello, I am trying to set up an automated Calculate feature function of sorts. I have a feature class with a field "Status" that I would like to be automatically changed to the same value in a field "Struct" from a related table when new record are added. The database relationship is one-to-many. GlobalID - GUID. Right now, I'm trying to do this in an attribute rule. I posted a similar question last week but I determined I was so far of base that I deleted it and now I'm trying again here.&lt;/P&gt;&lt;P&gt;Okay, so what I have so far is this:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var bldgGlobal = $feature.GlobalID;
console(bldgGlobal);

var relatedTable = FeatureSetByName($datastore, "epgdb.PARKS.ParkBuilding_Inspection");

// Filter related records based on the GlobalID field
var filteredRecords = Filter(relatedTable, 'GUID = @bldgGlobal'); // Use the "@" symbol here for the variable

var structValues = [];

// Loop through the filtered related records
for (var i in filteredRecords) {
  var relatedRecord = filteredRecords[i];&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The filter statement looks like it's working correctly. I image I need to use a for loop, which is why I include it here. What I don't really know how to do it populate the field (or indeed if it's even possible, since the attribute rule would run on the feature class when it's updated. Another thought I had, would it be better to try to run this attribute rule on the related table as opposed to the feature class?).&lt;/P&gt;</description>
    <pubDate>Mon, 18 Sep 2023 13:56:48 GMT</pubDate>
    <dc:creator>ZachBodenner</dc:creator>
    <dc:date>2023-09-18T13:56:48Z</dc:date>
    <item>
      <title>Copy value from related record to parent feature via Arcade rule</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/copy-value-from-related-record-to-parent-feature/m-p/1329588#M73165</link>
      <description>&lt;P&gt;Hello, I am trying to set up an automated Calculate feature function of sorts. I have a feature class with a field "Status" that I would like to be automatically changed to the same value in a field "Struct" from a related table when new record are added. The database relationship is one-to-many. GlobalID - GUID. Right now, I'm trying to do this in an attribute rule. I posted a similar question last week but I determined I was so far of base that I deleted it and now I'm trying again here.&lt;/P&gt;&lt;P&gt;Okay, so what I have so far is this:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var bldgGlobal = $feature.GlobalID;
console(bldgGlobal);

var relatedTable = FeatureSetByName($datastore, "epgdb.PARKS.ParkBuilding_Inspection");

// Filter related records based on the GlobalID field
var filteredRecords = Filter(relatedTable, 'GUID = @bldgGlobal'); // Use the "@" symbol here for the variable

var structValues = [];

// Loop through the filtered related records
for (var i in filteredRecords) {
  var relatedRecord = filteredRecords[i];&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The filter statement looks like it's working correctly. I image I need to use a for loop, which is why I include it here. What I don't really know how to do it populate the field (or indeed if it's even possible, since the attribute rule would run on the feature class when it's updated. Another thought I had, would it be better to try to run this attribute rule on the related table as opposed to the feature class?).&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 13:56:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/copy-value-from-related-record-to-parent-feature/m-p/1329588#M73165</guid>
      <dc:creator>ZachBodenner</dc:creator>
      <dc:date>2023-09-18T13:56:48Z</dc:date>
    </item>
  </channel>
</rss>

