Select to view content in your preferred language

Editing related tables in ArcSDE

574
2
09-19-2012 07:31 AM
AlisonGaiser
Deactivated User
I have a feature class (road centrelines) in SDE Oracle, that has multiple relationship classes to tables that contain information such as address ranges, maintenance class information, road lifecycle status, etc. For security reasons only the road editor role has permission to edit the road centreline feature class (all others are read only). The address editor role has permission to edit the address range table. The Maintenance group has permission to edit the maintenance table, etc. What I want to do is:

Road editor uses ArcMap to define the spatial road location. Saves edits, closes ArcMap
Address editor opens ArcMap, starts editing, selects the road segment and adds the associated address information

Here is my problem. When I start editing in ArcMap 10 (SP3) as the address editor, I can't see the attributes of the road and therefore can't get to the related record. The only method that I have been successful with is select the primary key value from the road centreline table, copy it, then start a new address table entry and paste the value into the foreign key field in the address table. This is clunky, so I keep thinking that I am missing something simple.

What button do I need to push to get the primary key to auto populate in my related table?  The relationship class is defined as simple and 1:1 .

This works just fine if I start the process by selecting the road, selecting the + to see the related information, selecting the address relationship, and saying add new. Then the new table entry is created and the primary key is automatically populated. But this will only work with providing permissions to edit all tables and feature classes. This is not really an option.

Thanks,
    Alison
0 Kudos
2 Replies
JakeSkinner
Esri Esteemed Contributor
Hi Alison,

You could create a python script to update the tables.  After the editors are finished updating the Roads feature class, they could run a script to update the corresponding table.  Here's an example:

import arcpy
from arcpy import env
env.workspace = r"Database Connections\ORCL.sde"

fc = "Roads"
table = "Addresses"

fcList = []

rows = arcpy.SearchCursor(fc)
for row in rows:
    fcList.append(row.getValue("CODE"))

del row, rows

tableList = []

rows = arcpy.SearchCursor(table)
for row in rows:
    tableList.append(row.getValue("CODE"))

del row, rows

for n in fcList:
    if n not in tableList:
        rows = arcpy.InsertCursor(table)
        row = rows.newRow() 
        row.CODE = n
        rows.insertRow(row)

try:
    del row, rows
except NameError:
    pass


The script above compares the Road features within the Primary Key (CODE) to the values within the Foreign Key (CODE) for the Addresses table.  If the value is not present in the Addresses table it will insert a record with this value.

The script can be added to a toolbox, and when the editor is finished editing, the user can execute the script by double-clicking it.  Or, if you are running ArcGIS 10.1 you could create a python add-in and have the user click a button from a toolbar once their edit session is complete.
0 Kudos
AlisonGaiser
Deactivated User
I am actually using workflow manager so potentially I could include this as a step in the job process. There are acutally multiple related tables, so I would likely want to add a row in each related table. I would need to be careful to remove the associated row though...

I just keep thinking that I am missing a step to make this much easier.

Thanks for the response, I will give it a try.
0 Kudos