Select to view content in your preferred language

Help Creating Attribute Rules That Allow Attributes to Flow Between Feature Class and Related Table

328
0
04-01-2024 01:40 PM
ChristopherBowering
Frequent Contributor

Hello.  I have come across a handful of posts aiming to accomplish very similar objectives.  However, the examples I've seen have all had nuances making the coding a bit too complex for me to simplify for my basic needs.  All I would like to do is transfer an attribute from a feature class field to a related table field and vice-versa.  My relationship classes are all GlobalID to GUID.  For a related table, I'd want the desired field to be populated upon record creation and updated when the corresponding parent feature class field is edited. 

I have come close thru modifying an example code I found (although I don't understand all of it) but the related table field only populates upon record creation.  It is not updating when the parent feature class field is updated despite the 'update' trigger being used.  I'll include the code below but am certainly open to something completely different.  I just want a basic way to do this!  Thanks!

@tbearb @JohannesLindner I have reviewed many of your posts and ideas regarding this.  If either of you are able to provide advice, that would be awesome.

 

//Pass attribute from Feature Class (field name is FID) to Related Table (field name is FID)
//Field: FID
//Triggers: Insert, Update
//Execution: Exclude from Application Evaluation (have also attempted without this being checked on)

var Features = FeatureSetByName($datastore, 'OCGIS.OCGIS.DPW_TESTING');
var globalid = $feature.GUID
var filterStatement = 'GlobalID = @globalid'
var Related_Table = Filter(Features, filterStatement)
var cnt = Count(Related_Table);

var results = "";

if (cnt > 0) {
for (var row in Related_Table) {
var line = row.FID;
results +=line;
}
} else {
results = "No related record";
}
return results;

 

 

0 Kudos
0 Replies