Hello,
I was hoping to get some help with my code. I am trying to use FeatureSetByName to get a certain Relationship Table of a M:N relationship. I want to get the table to implement my code so that, for whatever reason, if a unique identifier changes then it also changes accordingly in the Relationship Table so that nothing breaks. I tried looking on the forums but I can't even confirm if this function can be used to get a relationship table, but it seems to work for standalone tables.
More context: The long layer name is the name of the M:N Relationship Class and when I drag that onto the map it gives me the standalone M:N Relationship Table. The Relationship Table has the same name as the Relationship Class.
Here is my Error Code: 001841: The table was not found.
Here is my code: (sorry for the long layer names, doing tests before using the real layers)
if($originalfeature.AddressID == $feature.AddressID) {
}
else {
var FS = FeatureSetByName($datastore, 'physicaladdressexportfeature_BuildingFootprintss', ['GlobalID', 'Address_ID'], false)
var AddressID = $originalfeature.AddressID
var relation = filter(FS, 'Address_ID= @AddressID')
var updatelist = []
var counter = 0
if(relation == null) {
}
else {
for(var x in relation) {
updatelist[counter] = {
'globalid': x.GlobalID,
'attributes': {
'Address_ID': $feature.AddressID,
}
}
counter++
}
return {
'edit': [{
'className': 'physicaladdressexportfeature_BuildingFootprintss',
'updates': updatelist
}]
}
}
}