Hi gang,
For some reason I can't get this code to work. I'm simply trying to set a definition query on a layer. The pertinent code is:
The script runs fine, but no definition query is applied to the layer once it has completed.
Any help?
EDIT: I figured it out :D
I had to add str() is all.
For some reason I can't get this code to work. I'm simply trying to set a definition query on a layer. The pertinent code is:
Code:
mxd = arcpy.mapping.MapDocument("CURRENT")
theProj = arcpy.GetParameter(1)
for lyr in arcpy.mapping.ListLayers(mxd):
if lyr.name == theProj:
lyr.definitionQuery = '"PROJ_TYPE" = \'C\' OR "PROJ_TYPE" = \'VC\''Any help?
EDIT: I figured it out :D
Code:
mxd = arcpy.mapping.MapDocument("CURRENT")
theProj = arcpy.GetParameter(1)
for lyr in arcpy.mapping.ListLayers(mxd):
if lyr.name == str(theProj):
lyr.definitionQuery = '"PROJ_TYPE" = \'C\' OR "PROJ_TYPE" = \'VC\''I had to add str() is all.