roryosborne

UpdateCursor in a loop overwrites itself

Discussion created by roryosborne on Mar 1, 2011
Latest reply on Mar 2, 2011 by bposthumus
Hi,
I'm trying to populate a dbase table with an update cursor. I have one loop for the first 2 columns, using an insertCursor, then I need to add further fields to the same table. The insert cursor works fine, but the update cursor overwrites itself on the first line every time. ideas?

if m == 0:
            rows = arcpy.InsertCursor(newTable)
            row = rows.newRow()
            row.DAUID = a
            row.setValue(fields[m], e)
            rows.insertRow(row)
               
elif m > 0:
            rows = arcpy.UpdateCursor(newTable)
            row = rows.next()
            row.setValue(fields[m], e)
            rows.updateRow(row)

Outcomes