Can anyone help me with a python script that will change the definition query of two layers to the same thing. I have 2 layers that I want to change the definition query on at the same time to the same value(s). ex) Layer1 Definition Query ---[pid] = 4 Layer2 Definition Query ---[pid] = 4
I want to be able to update both definition queries in one step using python.
import arcpy
queryStr = "Hello World"
mxd = arcpy.mapping.MapDocument("CURRENT")
for lyr in arcpy.mapping.ListLayers(mxd):
if lyr.supports("DEFINITIONQUERY"):
lyr.definitionQuery = queryStr
del mxd