Hi there, I am trying to do a select layer by location and for the selected records populate a specific field with a value of "Y". Then, for all fields that were not selected, I want to tag with a "N". I can get the "Y"'s to populate but once I start doing the looping logic with the update cursor I either get an error or the loop keeps on going...
here is my code: thanks for any help!!
# Import system modules
import sys, string, os, arcgisscripting
# Create the Geoprocessor object
gp = arcgisscripting.create(9.3)
# Set the workspace
workspace = gp.GetParameterAsText(0)
gp.workspace = workspace
# Load required toolboxes...
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")
# Variables
InputFC = gp.GetParameterAsText(1)
IntersectFeat = gp.GetParameterAsText(2)
Field = gp.GetParameterAsText(3)
# Make a layer from the feature class
gp.MakeFeatureLayer(InputFC,"Layer")
gp.MakeFeatureLayer(IntersectFeat,"Layer2")
# Process: Select Layer By Location...
gp.SelectLayerByLocation_management("Layer", "INTERSECT", "layer2", "500 Meters", "NEW_SELECTION")
gp.CalculateField_management("Layer", Field, "\"Y\"")
FLlist = gp.ListFields("Layer")
print str(FLlist)
for fl in FLlist:
row = gp.UpdateCursor(fl)
row = rows.Next()
while row:
if row.EXTERNALCOATING == "Y":
pass
else:
#row.EXTERNALCOATING == "N"
row.setvalue("EXTERNALCOATING", "\"N\"")
rows.updaterow(row)
row = rows.Next()
break
del row
del rows