I have 2 similar but unrelated feature layers, one is the original and the other a "clone" with all the same records but with a different default sorting.
How can I set up a way to append new records from the original table layer to the clone layer table automatically? Is it through Relationship Class? Do I need a Python/Arcade expression?
Thanks for your input.
The answer might depend on your DBMS. What type of database is your data in? An enterprise geodatabase, file geodatabase, etc.?
If it is an enterprise geodatabase, I believe you can setup a trigger in the DB that triggers when a new record is inserted into the table that will write that record to the other table.
Unfortunately, I don't think automatically copying records from one table to another upon insert of a new record is something that is possible in a file geodatabase, but someone might be able to correct me if I'm wrong. My best advice for that scenario would be to create a model or script that periodically syncs the original table with the cloned table.
On a side note, I don't know what your use case is for creating the "cloned" table, but if it's just for the purpose of sorting, you can just create a "copy" of the layer in the table of contents in ArcGIS Pro and change the sorting that way. That way you have two different layers in the map with different sorting, but they are both using the same source table so you don't have to deal with two different copies of the same table. Meaning that any updates you make in that table will be reflected in all copies you made in the table of contents.
My data are stored in a file geodatabase, so I think I will try your suggestion about creating a model that would periodically syncs new data from one table into the other.
Thank you for your help Ryan, and happy new year!
You should be able to do it just fine with attribute rules in a file geodatabase. Check out Attribute rule dictionary keywords—ArcGIS Pro | Documentation
here's a very rough example
var retDict = {"edit":[{"className":"pointb",
"adds":[{"globalID":$feature.GlobalID,
"geometry": Geometry($feature),
"attributes": {"name": $feature.name}
}]
}]}
console(retDict)
return retDict
Keep in mind that in this example I haven't done anything to link the two tables via foreign key or anything, so I would probably make sure the secondary table has a relID field and pass in the main table's primary key or globalID for it.
Also. Why do you need two copies of the table if the only difference is the sorting?