I am trying to write a script that will go through a grid layer that has individual 535 grid squares.
I want to find a way that will tell me how much gas main is left to be checked in each grid. Any pipe newer than 2011 does not need to be checked.
I would like to write a script that could be run on a weekly basis to check the progress of the gas main layer because it is being edited by numerous users. To manually do this for grid square I usually do select by attributes with the query "Grid number = (#)", the layer has from 1 to 535, after I use select by location to select all gas main that is inside that individual grid square, then I remove the pipe that has prime and is newer than 2011, then export it to an Excel file.
I want the output of the script to create an Excel file with all remaining OIDs in the gas main layer to be validated for each individual grid square, so 535 different Excel sheets.
How do I get the value that is in the grid number field and store it as a variable to use in the select by attributes tool ("Grid_Number = (variable)" and change as it iterates through each row?
import arcpy count = arcpy.da.UpdateCursor("keymap", "miles_left") with count as cursor: if(row0]>=0 and row <= 354): select by attributes(key map = %) select by location (gas main in kepy map) select by attributes (remove prime, remove new than 2011) export to excel update miles_left field