cfoster15

Using Defintion Query in a Python Script

Discussion created by cfoster15 on Oct 9, 2013
Latest reply on Oct 9, 2013 by Wayne_Whitley
I have a script that is using a parcel feature class from SDE.  This parcel feature has Right-of-Way (ROW) information.  I would like to use a definition query so that when I do a select by location, the ROW features are not in the selection.

for layer in arcpy.mapping.ListLayers(mxd, "*"):
     if layer.name == "DOUGLAS_GIS.GISDATA.Parcel_Boundary":
          layer.definitionQuery = "'TAG' IS NOT \'ROW %\'"


Could someone please look at this syntax and let me know if there is something wrong?

This is the definition query that I use in an MXD.

TAG NOT LIKE 'ROW %'



Thanks,

Chad

Outcomes