AnsweredAssumed Answered

searchcursor on layer using text field and query

Question asked by DamianMilne on Mar 11, 2014
Latest reply on Mar 13, 2014 by rfairhur24
Hi, I'm trying to use a SearchCursor to loop through specific records in a layer in an ArcMap project.  I would like loop through specific records based on a text field in the layer but I'm having trouble figuring out the syntax. Can anyone help please? Code below.

# Set the variables mxd = arcpy.mapping.MapDocument(r"\\working\BioFire.mxd") df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0] lyr = arcpy.mapping.ListLayers(mxd,"Fire",df)[0]  # Loop through specified records in layer  ### I CAN'T FIGURE OUT THE CODE FOR THIS NEXT BIT cur = arcpy.SearchCursor(lyr, '"FIRECODE" in ("ARC", "CEA", "DAB", "MGD")')    ### IF I USE THE LINE BELOW INSTEAD IT WORKS FINE BUT LOOPS THROUGH ALL RECORDS WHICH I DON'T WANT #cur = arcpy.SearchCursor(lyr)  . . . . 

Cheers, Damian