I have a python script that runs periodically that updates a "status" attribute based on location relative to another feature class.
I have a SQL table that has a list of individual exceptions, where the status is not determined solely by location.
Both the feature class that I'm trying to update and the SQL table have a unique identifier. How can I change the attribute based on the unique identifier's presence in the other table?
For example, the house with the unique ID# 12345 is updated to "available" because it within the determined distance of a property I just bought. However, I am uninterested in red houses. The table of red houses lists #12345. I need to change #12345 back to "unavailable" because it's in the list.
Maybe something like this to get you started...
fc = "fc"
fc1 = "fc1"
fcH_ID = []
fc1H_ID = []
with arcpy.da.SearchCursor(fc, ["House_ID"]) as cursor:
for row in cursor:
fcH_ID.append(row[0])
del row, cursor
with arcpy.da.SearchCursor(fc1, ["House_ID"]) as cursor:
for row in cursor:
if not row[0] in fcH_ID:
fc1H_ID.append(row[0])
del row, cursor
for ID in fc1H_ID:
arcpy.SelectLayerByAttribute_management(fc1, "ADD_TO_SELECTION", "House_ID = " + str(ID) # and House_ID = "Red"