I have a table(Table1) that i need to update on a regular basis by comparing/matching the records in the (Table1) to the table (Table2) based on field "Street" of Table1 and "FullStName" of table two. If theirs NOT a match it then updates the table1 based on the NOT matched from the table and I also need it to add "FullStName" have have "RES", "Reserved", "proposed" in the "status" field of table2. I need to add the missing names of tabel2 to table 1. Hopefully it make sense.
This is what i have but i am not sure i am doing it right...
import arcpy
from arcpy import env
arcpy.env.workspace = r"C:\Temp\Default.gdb\RoadNames"
Rtable = "table1"
table1 = "table2"
fcIncident = []
tableIncident = []
with arcpy.da.SearchCursor(Rtable, ["Street"]) as cursor:
for row in cursor:
fcIncident.append(row[0])
del row, cursor
with arcpy.da.SearchCursor(table1, ["FULLSTNAME", "STATUS"]) as cursor:
for row in cursor:
if row[1] in ("RES", "Reserved", "proposed"):
if not row[0] in fcIncident:
tableIncident.append(row[0])
del row, cursor
arcpy.MakeTableView_management(table1, "tblView")
for ID in tableIncident:
arcpy.SelectLayerByAttribute_management("tblView", "ADD_TO_SELECTION", "FULLSTNAME = " + str(ID))
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>