AnsweredAssumed Answered

Order of da.UpdateCursor

Question asked by DMMotti on Apr 7, 2015
Latest reply on Apr 10, 2015 by bixb0012

Hello

 

I'd like to manipulate the order the update cursor loops through my attribute table.

At the moment, my code looks as follows:

 

with arcpy.da.UpdateCursor(lyr, column) as cursor:

        for row in cursor:

            row[0] = i

            i = i+1

            cursor.updateRow(row)

 

where "lyr" is my layer and "column" is my column where the cursor needs to update the data. at the moment loops through and adds 1 as it needs but it does it in the order of the Object ID. I have an other column named "Nummer" where I have Numbers (Doulbe). The coursor should update the rows following those numbers (from 1 to x). How can I do it?

 

I tried "with arcpy.da.UpdateCursor(lyrkartenausschn, seitenzkartenausschn,"","","", sql_clause=(None, 'ORDER_BY Nummer A') as cursor: "

And also without all of those "", "", and also with "ORDER BY"  and with/without the "A". But it always gives me an error.

 

Can anyone help me fixing this part of the code?

 

thanks! :-D

Outcomes