0

This question already has an answer here:

I have some address points selected for which that I want to update the address field based upon the row in the selection. How do I figure out the name of the selection taable to pass to arcpy.UpdateCursor()?

marked as duplicate by Jason Scheirer, whuber Nov 27 '13 at 21:56

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Could you edit your post to explain more what you're trying to do? Also, what version of ArcMap are you using? – Paul Aug 16 '13 at 16:20
  • I am using ArcGIS 10.1. I have a selection of points that refer to the placement of buildings in a larger feature class of building points. I want to put the row number of the selected rows in the building address field. Is it possible to place the row of the selection into a field of a group of selected rows? I don't know what the name of the table is since I only want to change the building number field in a few (selected) rows of a table. – Paul Kranz Aug 19 '13 at 11:35
0

If you're simply isolating selected features for use with an update cursor, it should be as simple as -

use gp.MakeFeatureLayer("featureclass", "featlyr")
cursor = gp.UpdateCursor("featlyr", "", "", "BLDADDRESS")
row = cursor.next()
while row:

    rownum = row.getValue("OID_or_NUM")
    row.setValue("BLDADDRESS", rownum)
    cursor.updateRow(row)
    row = cursor.Next()
0

I think you can only do that from a Python Add-In.

pythonaddin.GetSelectedTOCLayerOrDataFrame()

Not the answer you're looking for? Browse other questions tagged or ask your own question.