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

598
4
01-03-2018 12:52 PM
Highlighted
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

Reply
0 Kudos
4 Replies
Highlighted
MVP Esteemed Contributor

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 

Highlighted
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 

Highlighted
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

Reply
0 Kudos
Highlighted
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).