Inserting values in arcgis table by trigger and increasing the object id index value

3936
1
Jump to solution
04-17-2015 05:04 AM
MartinSirkovsky
Occasional Contributor

Hi.

We have setup a feature class for road drains. The feature class is published as a feature service and inspectors are cleaning the drains regularly. Once the drain was cleaned, the inspection is registered via Collector for ArcGIS in the database.

To simplify the process we have setup one field which need to be changed to register the inspection. Once the field value is changed, the database triggers ensures that some additional fields in the feature class are modified. This works fine.

I have also setup a relational table, let’s say “inspection log”, which holds records of particular inspections. Once the inspection is registered, the trigger also adds the inspection record to the “inspection log” table. However, to enter a record I need to enter a unique objectid to inspection log table (the objectid must be entered explicitly, it is not added automatically), which I do by determining the current max objectid and increasing it by one. This works fine.

However, when I later try to enter a record to inspection table directly from ArcMap, the insert fails, because the next available objectid known to ArcGIS was used when entering the records by trigger.

Is there any way how to update the value of next available objectid in arcgis system tables. I found a column named last_id in feature class’ i-Table, but it seems, that altering the value do not make any difference when entering new record.

I know it is not recommended to alter system tables directly, but I would appreciate help, if somebody knows the safe and correct way to do this with the triggers.

Just for a record, we are using PostgreSQL as DBMS and version 10.3 of ArcGIS software.

Thank you

Martin

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
ErinBrimhall
Occasional Contributor II

Martin,

Have you tried using the sde.next_id procedure inside your trigger to obtain the object ID (instead of MAX() + 1)?

That should ensure you get an appropriate object ID while also maintaining the correct state in the system tables.

View solution in original post

1 Reply
ErinBrimhall
Occasional Contributor II

Martin,

Have you tried using the sde.next_id procedure inside your trigger to obtain the object ID (instead of MAX() + 1)?

That should ensure you get an appropriate object ID while also maintaining the correct state in the system tables.