Select to view content in your preferred language

Copy value from related record to parent feature via Arcade rule

09-18-2023 06:56 AM
Labels (3)
MVP Regular Contributor

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.

Okay, so what I have so far is this: 

var bldgGlobal = $feature.GlobalID;

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];


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?).

0 Kudos
0 Replies