I try to explain here what I am trying to do:
I have one shapefile and one independent dbf table with the same fields. In the dbf table all the fields are populated but in the shapefile attribute table just one, lets name it "OneField". What I want to do is to check that the values from "OneField"(Shapefile) are the same as the values in "OneField"(dbf table) and if so, to populate the remaining empty fields in the shapefile attribute table with the ones in the independent dbf table.
At the moment I am trying just to copy the values from the independent dbf table to the shapefile attribute table but I am stuck.(when I run this code I get a message that pythonwin stopped working and nothing happens to the tables). Can you give me a hand please?
Here is the code:
import arcpy table = "link/to/table.dbf" fc = "link/to/shapefile.shp" # Create a search cursor rowsTable = arcpy.SearchCursor(table) # Create an update cursor rowsFc = arcpy.UpdateCursor(fc) for row in rowsTable: row = row.getValue("OneField") valueTable = row for row in rowsFc: row = row.setValue("OneField", valueTable) rowsFc.updateRow(row) row = rowsFc.next() row = rowsTable.next() del row, rowsFc, rowsTable