Dear Myretha,
Kindly use query to solve your problem.
For that some of these link will be helpful
ArcGIS Desktop
http://www.junipergis.com/files/5412/6870/0223/QueryBuilder.pdf
or
try this
An arcpy/python way to find like named layers in a map document would be to use the string .find()
method, see example below:
mxd = arcpy.mapping.MapDocument("CURRENT") commonNames = ['207900045', 'xyz', '1234'] for nameX in commonNames: foundLayersList = [] for lyr in arcpy.mapping.ListLayers(mxd): found = lyr.name.find(nameX) if found >-1: foundLayersList.append(lyr) # next do something with two found layers in the foundLayers list....
Alternatively, you could do this in one line combining the if condition and in method:
# same code as noted above before ListLayers statement for lyr in arcpy.mapping.ListLayers(mxd): if commonName in (lyr.name): foundLayersList.append(lyr) # ....
Or, you could do this in one line using list comprehension:
# same code as noted above before for nameX statement for nameX in commonNames: foundLayersList = [lyr.name for lyr in arcpy.mapping.ListLayers(mxd) if commonName in (lyr.name)] # next do something with two found layers in the foundLayers list....