AnsweredAssumed Answered

Adding to a Selection

Question asked by jborgion on Sep 7, 2017
Latest reply on Sep 8, 2017 by jborgion

Python hack (at best) here....

 

I would like to base a selection on an already selected record in a layer, and can't quite seem to crack that nut.  Here is the pseudo code:

 

Select a record  ' in this case a point

Extract the FullStreet attribute value  ' it'll be something like S MAIN ST

Add to the selection all other points that have that same FullStreet field value   'seems like a fairly simple operation

 

I've been trying to do that using an arcpy.SearchCursor  within the arcpy window :

 

>>> cursor = arcpy.SearchCursor("apLayer")
>>> for row in cursor:
... street = row.FullStreet
... arcpy.SelectLayerByAttribute_management ("apLayer","ADD_TO_SELECTION","FullStreet = 'street'")
...

>>>

This runs with no errors but only ends up with the originally selected point as being selected.  (See attached)

 

Questions:  is this a case of newbie syntax error?

                    is there a better approach to do what I intend to do?  

Attachments

Outcomes