How to detect that a record was inserted in a versioned FC

1072
4
01-03-2018 12:52 PM
JoseSanchez
Occasional Contributor III

Hello everyone,

We are looking for a way, -in a regular database it will be a trigger-, to detect that a record was inserted in a versioned feature class.

How can it be done in SDE?

Thanks

0 Kudos
4 Replies
JoeBorgione
MVP Emeritus

An SDE database isn't an irregular database; it's pretty much a regular database.  What backend are you using?  SqlServer? Oracle?

I had a trigger in a SQLServer-SDE db that updated a field called User and another one that updated a field called ModifyDate.

You can also take a look at Editor Tracking:

About tracking an editor's changes to data—Help | ArcGIS Desktop 

That should just about do it....
Asrujit_SenGupta
MVP Regular Contributor

Check the discussions in the below Posts and then let us know here if you need more info:

SQL Trigger in Versioned SDE 

Trigger on Versioned Geodatabase 

https://community.esri.com/thread/179700 

JoseSanchez
Occasional Contributor III

This is what we did. We versioned the layer with the option "Optional) If you want edits saved directly to the Default version—whether edited directly or merged in from other versions—to be saved in the base tables, check Register the selected objects with the option to move edits to the base".

Now we can add SQL Server triggers to run each time a record gets added in the feature class, not in the versioned tables.

The goal is to create a record in a regular SQL Server table when a feature gets created in the SDE Feature Class. The new record in the table gets populated with fields from the feature class. This process is designed to run in real time.

https://pro.arcgis.com/en/pro-app/help/data/geodatabases/overview/work-with-versioned-data.htm

0 Kudos
Asrujit_SenGupta
MVP Regular Contributor

Note: The "Register the selected objects with the option to move edits to the base" will only work when the edits are done in DEFAULT version. If new features are edited in any other version, the records still get written to the a- & d- Tables (Delta Tables).