Select to view content in your preferred language

UpdateCursor and Join

701
2
Jump to solution
01-20-2012 12:42 AM
OlivierOlivier
Regular Contributor
Hi,

I need to build a function that remove first and last point of lines. Soft works with SearchCursor but get 99999 error as soon as I try to use UpdateCursor. I think it could have a link with the Join but don't understand
Error occurs on UpdateCursor call when placed after join and when getvalue when UpdateCursor placer before Join.

Thanks for any help,

Olivier
-----------------------------
# Process: Make Feature Layer...
gp.MakeFeatureLayer_management(arc_shp, arc_layer, "", "", "ID_ARC ID_ARC VISIBLE NONE")
gp.MakeFeatureLayer_management(pnt_shp, pnt_layer, "", "", "ID_POINT ID_POINT VISIBLE NONE")

#rows_arc = gp.UpdateCursor(arc_layer)  #option 2

# Process: Add Join...
gp.QualifiedFieldNames = "UNQUALIFIED"
gp.AddJoin_management(arc_layer, "ID_ARC", tab_line, "ID_ARC", "KEEP_ALL")
gp.AddJoin_management(pnt_layer, "ID_POINT", tab_point, "ID_POINT", "KEEP_ALL")

rows_arc = gp.UpdateCursor(arc_layer) #option 1
desc_arc = gp.describe(arc_layer)
row_arc = rows_arc.Next()

while row_arc:
feat_arc=row_arc.getvalue(desc_arc.ShapeFieldName) # Get feature geometry
----------------------

So When I set option 1, UpdateCursor after join I get the error on the update call

    rows_arc = gp.UpdateCursor(arc_layer)
RuntimeError: ERROR 999999: Error executing function.

When I set option 1, Option 2 : UpdateCursor before join, I get the error at this line

    feat_arc=row_arc.getvalue(desc_arc.ShapeFieldName)

RuntimeError: ERROR 999999: Error executing function.

(I listed field names after join,  they are all there and I tried directly to set "arc.Shape" but it did'nt work.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MathewCoyle
Honored Contributor
As far as I know it is a known bug that has yet to be addressed (not sure if it was in 10.0 SP3 though). Here's a previous discussion on it.
http://forums.arcgis.com/threads/9507-Update-cursor-on-joined-tables

View solution in original post

0 Kudos
2 Replies
MathewCoyle
Honored Contributor
As far as I know it is a known bug that has yet to be addressed (not sure if it was in 10.0 SP3 though). Here's a previous discussion on it.
http://forums.arcgis.com/threads/9507-Update-cursor-on-joined-tables
0 Kudos
OlivierOlivier
Regular Contributor
Thanks Mathew ! I searched and didn't find this thread. So, instead of updating, I created a new shapefile. That does not work for everyone but is ok for what I wanted to do.
0 Kudos