I am new to Python scripting.
I would like to use SearchCursor to iterate in each row using the FID as index. Then I would like to evaluate length based on the following conditions:
- If the length >100 then (CAT remains at 0) and proceed to next row.
- If the next length is less than 100, then it should go back to the previous (immediate) row (that has a value of >100) and extract values in that row (FID, Length, CAT), and save them in an empty table, then the script should stop there.
fields = ["FID", "Length","CAT"]
with arcpy.da.SearchCursor(fc, fields) as cursor:
for row in cursor:
if row[1] > 100:
print (row[2])
elif row[1] < 100:
#Some code accessing the previous row here
print (row[0], row[1], row[2]) #to test what is to be printed