Hello all,
I am using ArcGIS Desktop 10.0 and I am trying to write a script in python.
I am having problems with the where clause in the searchcursor method.
Basically I have a CAD file and would like to identify from the CAD file all of the Annotations that have been flagged with a ??????? question mark.
So if I have the following list of Annotations in the Text filed of the Annotation CAD feature class, I would like to pull out the 3rd 5th and 6th rows using search cursor:
33334508
33304576
?97464800
64538300
?74537390
?64849300
I have managed to get the where clause in the search cursor to identify individual records but it keeps failing. I have attached an example of the CAD file and also the script.
I believe that the problem may be that the ???question mark??? is confusing the where clause. I have tried to escape the non standard characters and also writing the where clause as a variable but do not seem to be getting anywhere.
If anyone could help it would be really appreciated, I copy my script below......
Regards,
Kevin
import arcpy
from arcpy import env
env.workspace = r"C:\CADfile.dwg"
#This does not work: cur = arcpy.SearchCursor("Annotation",'LEFT("Text",1)='[\\?]'',"","","")
#This works: cur = arcpy.SearchCursor("Annotation","\"Text\" = \'69570020\'")
#This works: cur = arcpy.SearchCursor("Annotation",'"Text" < \'1\'')
cur = arcpy.SearchCursor("Annotation",'\"Text\" LIKE \'\?\%\'\')
# Iterate through the rows in the cursor
for row in cur:
print "Layer: %s, Parcel: %s" % \
(row.Layer, row.Text)
del cur, row