AnsweredAssumed Answered

Get the OID of a selected record?

Question asked by ionarawilson on Jul 9, 2013
Latest reply on Jul 12, 2013 by ionarawilson
I need to have a record selected for the user to enter some attributes, then I need to deselect to calculate a unique id for the record (I only know how to calculate the unique id for all the records and that;s why I need to deselect it), then I need to continue updating that record that was selected before. For that I need to capture the OID of the selected record before I deselect it. I was able to write something to get the OID, but it gets the OID for all the records. Does anybody know how to get the OID for just the selected record? Thank you! Here is my snippet:

    # Create search cursor for feature class.     rows = gp.SearchCursor("Stewardship")     row = rows.Next()     while row:         # Get the ID value         desc = arcpy.Describe("Stewardship")         OIDFieldName = desc.OIDFieldName         id = row.GetValue(OIDFieldName)         arcpy.AddMessage(id)         row = rows.next() 

Outcomes