Select to view content in your preferred language

AutoPopulate a field based on ObjectID value when a feature is created

1052
2
06-05-2013 03:12 PM
NathalieNeagle
Regular Contributor
When a new feature is created I want to autopopulate a field "FeatureID" based on the value of the "ObjectID" (assigned unique ID ArcGIS).  I thought I could setup the GDB to handle this, similar to setting a default value for domains but there is no way to setup a Calculation of a field when a new feature is created.  Can anyone tell me how I could accomplish this task?

Thanks
Nathalie
0 Kudos
2 Replies
WilliamCraft
MVP Alum
If you are looking to autopopulate a field based on the value of OBJECTID, your best bet is to create a Trigger in my opinion.  When a new record is added and the OBJECTID value is autogenerated by ArcSDE, your trigger will be able to use that value to determine the value of your custom field.  However, the trigger will need to fire after the OBJECTID trigger from ArcSDE fires.  There is some great online help available for creating basic triggers like this for both Oracle and SQL Server depending on which RDBMS you are using.  If you are not using an RDBMS, your options are much more limited and you'll need to take a different approach... most likely using a Python script which is run on a periodic basis.
0 Kudos
LeoDonahue
Deactivated User
...I want to autopopulate a field "FeatureID" based on the value of the "ObjectID" (assigned unique ID ArcGIS).


I don't think you can count on the ObjectID value being something predictable that you can count on.  You have little control over the value of that number.
0 Kudos