agarem

moving attributes from one table to another based on selection

Discussion created by agarem on Jan 10, 2013
Latest reply on Jan 10, 2013 by mzcoyle
I am trying to move through my contractBuffer layer record by record. For each record I want to select the culverts from the culvert_subset that fall within that record. Then take the value from the GWP field from my contractBuffer layer and populate the GWP field in the culvert subset for all those that fall within that first record. Then move to the second record in the contract buffer layer select all the culverts that fall within and so on.
I know that I need to be using searchcursor and updatecursor.
I think this is close to what I need to be doing however I am not sure and know that I am missing pieces. If anybody could help or make suggestions that would be great!! Thank you!

import arcpy

 Srlist = []

 rows = arcpy.SearchCursor("Contract_Buff")
 row = rows.next()
 
 while row:
     Srlist.append(row.getValue("GWP"))
     row = rows.next()
 
 Cul_rows = arcpy.UpdateCursor("Culvert_subset",GWP)

 while Cul_row:
     for Cul_row in Cul_rows:
  (i think this is where my query needs to go to select only those culverts that fall within the boundary of the first record in the contract buff...not sure how)
 
  row.updateRow(row)
 Cul_row = Cul_rows.next()

Outcomes