I am new to Arcade and attribute rules. I am trying to update on table and have it update anothertable. I am using the example here:
An Attribute Rule to keep two geodatabase tables in sync
My test SDE database is named BaseData. In there is a Feature Dataset named BaseData.DBO.InVision. There are two layers one is BaseData.DBO.Building and the other is BaseData.DBO.BuildingFloor. They both share a unique ID called BUILDINGKEY. I am trying to sync the attribute Description. here is my Arcade code:
if ($editContext.editType == "UPDATE") {
//we are updating the row, in this table, so we need to get the corrsponding row in the second table and update it.
var id = $feature.BUILDINGKEY;
var fs = FeatureSetByName($datastore, "BaseData.DBO.BuildingFloor");
var destinationRow = first(Filter(fs, "id = <a href="https://community.esri.com/t5/user/viewprofilepage/user-id/354972">@ID</a>"));
//this should not happen but catching it just in case
if (destinationRow == null) return { "errorMessage": "table out of sync!, we tried to update a row that doesn't exist in the other table.. something is wrong." }
//we can relax that and create the row instead to sync it .
//we need to prevent the update if all fields are the same (otherwise we will be in an infinite cycle
if (destinationRow.DESCRIPTION == $feature.DESCRIPTION) return; //no change quit
//else lets sync them!
return {
"edit": [
{
"className": "BaseData.DBO.BuildingFloor",
"updates": [{
"globalID": destinationRow.globalId,
"attributes": {
"DESCRIPTION": $feature.DESCRIPTION
}
}]
}]
}
}I get this error when i try and update:
Update table row failed.
Failed to evaluate Arcade expression. [
Rule name: ADA_Update,
Triggering event: Update,
Class name: BaseData.DBO.Building,
GlobalID: {E1222E13-8220-4987-A30A-5186B0E09C10},
Arcade error: Field not found id,
Script line: 5]
If anyone has any ideas i would appreciate the help. thank you.