AnsweredAssumed Answered

Select Layer by Attribute Return Type?

Question asked by MollyKFoley on Oct 30, 2018
Latest reply on Oct 30, 2018 by dkwiens

I thought the return type of Select Layer by Attribute would be a layer... but instead I get a result object, so I can't use .getSelectedExtent() on it. This is what I've got.:


import arcpy

fc = r'Database Connections\OS_FocalAreas.sde\FocalAreas.DBO.FocalReferenceAreas'
boo = arcpy.MakeFeatureLayer_management(fc, "fc")

expression = "StateID = 'VA' and Name = 'B Preserve Focal Area'"
arcpy.SelectLayerByAttribute_management(boo, "NEW_SELECTION", expression)
extent = boo.getSelectedExtent()



Traceback (most recent call last):
File "C:\xxx\", line 8, in <module>
extent = boo.getSelectedExtent()
AttributeError: 'Result' object has no attribute 'getSelectedExtent'