Calculate related table column based on related feature field using arcade

07-23-2021 08:05 AM
Labels (2)
Occasional Contributor III

I have a bridge feature class with a related table of reports

After everything was built, got request to add a custom ID field to the related table that directly reference a field in my feature class.

Based on research, I need to grab the related GlobalID, filter my feature set, and return the needed field to calculate my custom ID.

For example, report 41 needs to have a field calculated to pull the bridge number associated with that report and.

This is what I was thinking but now I'm not sure I'm doing it right.  Wish Pro had an Arcade Playground for testing functions in field calculator.

I am calculating the field in the related table.

I think I'm not accessing the filter result correctly...

// reference feature service
var fl = FeatureSetByName($datastore, 'PM_Bridges')

// read the associated bridge GlobalID stored in my related table
var bridgeGUID = $feature.REL_GLOBALID

//sql for filtering feature service 
var sql = "GlobalID = '" + bridgeGUID + "'"

// go to bridge feature service & filter by GUID
var bridge = Filter(fl, sql);

//returns string - both fields already string type
var name = bridge.BRIDGENUM + " " + bridge.BMS

return name;


0 Kudos
0 Replies