<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Update a feature class based on another table in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/update-a-feature-class-based-on-another-table/m-p/250020#M19279</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN style="font-style:italic;"&gt; If there is a match it then updates the feature class(fc) based on the match from the table(not sure if that makes sense).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can accomplish by simply Joining the table to the feature class using the '&lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//001700000064000000" rel="nofollow noopener noreferrer" target="_blank"&gt;Add Join&lt;/A&gt;&lt;SPAN&gt;' function.&amp;nbsp; Next, run the '&lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00170000004m000000" rel="nofollow noopener noreferrer" target="_blank"&gt;Calculate Field&lt;/A&gt;&lt;SPAN&gt;' function to update the required fields.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;Else: the unmatched records from the table (Table1) are new, so it takes these new records&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can get the unmatched records by comparing a list of Incident IDs from the feature class and table, and then selecting the incidents that are unmatched.&amp;nbsp; Ex:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;fc = "fc"
table = "table1"

fcIncident = []
tableIncident = []

with arcpy.da.SearchCursor(fc, ["INCIDENT_ID"]) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcIncident.append(row[0])

del row, cursor

with arcpy.da.SearchCursor(table, ["INCIDENT_ID"]) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not row[0] in fcIncident:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tableIncident.append(row[0])

del row, cursor

arcpy.MakeTableView_management(table, "tblView")

for ID in tableIncident:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management("tblView", "ADD_TO_SELECTION", "INCIDENT_ID = " + str(ID))&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;which should also add XY fields and a spatialjoin of the geocode result&amp;nbsp; with 3 polygon feature classes (ccd, ced, scd) and updates the necessary&amp;nbsp; fields(ccd_name, ccd_desc, ced_name, ced_desc , scd_name and scd_desc)&amp;nbsp; in the feature class(fc) based on the spatialjoin&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can now &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//002600000006000000" rel="nofollow noopener noreferrer" target="_blank"&gt;geocode&lt;/A&gt;&lt;SPAN&gt; the "tblView", create the Spatial Join, and update the required fields:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.GeocodeAddresses_geocoding("tblView", .....)
FCs = [ccd, ced, scd]
for fc1 in FCs:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SpatialJoin_analysis(fc1, geocodeResult, fc1 + "_join")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(fc, "fcLyr")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(fc1, "fc1Lyr")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddJoin_management("fcLyr", "INCIDENT_ID", "fc1Lyr", "INCIDENT_ID", "KEEP_COMMON")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management("fcLyr", "fc.ccd_name", ....)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management("fcLyr", "fc.ccd_desc", ....)
&amp;nbsp;&amp;nbsp;&amp;nbsp; ....&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note:&amp;nbsp; the field name will change when a join is present.&amp;nbsp; The field name will begin with the feature class/table name.&amp;nbsp; i.e. "parcels.ccd_name"&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 12:25:49 GMT</pubDate>
    <dc:creator>JakeSkinner</dc:creator>
    <dc:date>2021-12-11T12:25:49Z</dc:date>
    <item>
      <title>Update a feature class based on another table</title>
      <link>https://community.esri.com/t5/python-questions/update-a-feature-class-based-on-another-table/m-p/250019#M19278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello All:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am a newbie in python and working on a script that is supposed to update a feature class (fc) based on another table (Table1) by comparing/matching the records in the feature class (fc) to the table (Table1) based on a field "INCIDENT_ID." If there is a match it then updates the feature class(fc) based on the match from the table(not sure if that makes sense). Else: the unmatched records from the table (Table1) are new, so it takes these new records, performs a geocode which should also add XY fields and a spatialjoin of the geocode result with 3 polygon feature classes (ccd, ced, scd) and updates the necessary fields(ccd_name, ccd_desc, ced_name, ced_desc , scd_name and scd_desc) in the feature class(fc) based on the spatialjoin. So far, I have not been able to get the script to run and produce the desired output. And will gladly appreciate any help I can get to stir me in the right direction. I have also attached the script and the sample data I am working with.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;#Import system modules
import arcpy
import os
from arcpy import env

#Set environment
env.workspace = r"C:\Users\tim.bash\Documents\ArcGIS\test.gdb"

#Allow overwrite
arcpy.env.overwriteOutput = True

#Define table and features
Table = r"C:\Users\tim.bash\Documents\ArcGIS\test.gdb\Table1"
fClass = r"C:\Users\tim.bash\Documents\ArcGIS\test.gdb\TestData\fc"
ccd = r"C:\Users\tim.bash\Documents\ArcGIS\test.gdb\TestData\ccd" #polygon feature class
ced = r"C:\Users\tim.bash\Documents\ArcGIS\test.gdb\TestData\ced" #polygon feature class
scd = r"C:\Users\tim.bash\Documents\ArcGIS\test.gdb\TestData\scd" #polygon feature class



# fields from the table that should&amp;nbsp; match the fClass
fieldTable = "INCIDENT_ID"
fieldFclass = "INCIDENT_ID"

# Create cursors
cur = arcpy.UpdateCursor(fClass)
row = cur.Next()

while row:
 #Get the values in fieldTable from field "INCIDENT_ID"
 fieldFclassID = row.GetValue("INCIDENT_ID")
 
 cur2 = arcpy.SearchCursor(Table)
 row2 = cur2.Next()
 
 while row:
 
&amp;nbsp; #Get the values in the fieldTable from field "INCIDENT_ID"
&amp;nbsp; fieldTableID = row2.GetValue("INCIDENT_ID")
&amp;nbsp; 
&amp;nbsp; #If there is a match
&amp;nbsp; if fieldFclassID == fieldTableID:
&amp;nbsp; 
&amp;nbsp;&amp;nbsp; fClass = row2.GetValue(fieldTable)
&amp;nbsp;&amp;nbsp; row.SetValue(fieldFclass, fClass)
&amp;nbsp;&amp;nbsp; cur.UpdateRow(row)
&amp;nbsp;&amp;nbsp; print "Updated: ", fclass
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; #Exit out of loop if match is found
&amp;nbsp;&amp;nbsp; break
&amp;nbsp; row2 = cur2.Next()
 
 row = cur.Next()

#if match is not found, proceed to geocode
address_table = "Table"
address_locator = r"C:\Users\tim.bash\Documents\ArcGIS\test.gdb\Addresses_Zip_Locator"
geocode_result = "geocode_result"

#Add XY fields to the geocode_result and calculate XY
sr = arcpy.SpatialReference(3032)

with arcpy.da.UpdateCursor(geocode_result, ["SHAPE@XY", "X", "Y"], "", sr) as cursor:
 for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[1] = row[0][0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[2] = row[0][1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(row)

del row, cursor


##Proceed to spatialjoin geocode_result with ccd, ced and scd

#create a polylayer
polylayers = [ccdlayer, cedlayer, scdlayer]

#make a feature layer for each polygon feature class
try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(ccd, ccdlayer)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(ced, cedlayer)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(scd, scdlayer)
except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.GetMessages()


# create an update cursor for the spatialjoin process
rows = arcpy.UpdateCursor(geocode_result)

for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; rowshape = row.Shape
&amp;nbsp;&amp;nbsp;&amp;nbsp; for layer in polylayers:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByLocation_management(layer, "WITHIN", rowshape, "", "NEW_SELECTION")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count = int(arcpy.GetCount_management(layer).getOutput(0))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.GetMessages()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if count &amp;gt; 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rowslayer = arcpy.SearchCursor(layer)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for rowlayer in rowslayer:
&amp;nbsp; if layer == ccdlayer:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.ccd_name = str(int(rowlayer.CNCLDIST02))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.ccd_desc = rowlayer.DistrictMembers
&amp;nbsp; if layer == cedlayer:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.ced_name = str(rowlayer.SECTION_ID)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.ced_desc = str(rowlayer.SECTION_ID)&amp;nbsp; 
&amp;nbsp; if layer == scdlayer:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.scd_name = str(int(rowlayer.SUPER))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.scd_desc = str(rowlayer.DistrictMembers)

rows.updateRow(row)

#Delete cursor and row objects to remove locks on the data
del row
del rows&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2014 18:24:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-a-feature-class-based-on-another-table/m-p/250019#M19278</guid>
      <dc:creator>TimBash</dc:creator>
      <dc:date>2014-02-10T18:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: Update a feature class based on another table</title>
      <link>https://community.esri.com/t5/python-questions/update-a-feature-class-based-on-another-table/m-p/250020#M19279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN style="font-style:italic;"&gt; If there is a match it then updates the feature class(fc) based on the match from the table(not sure if that makes sense).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can accomplish by simply Joining the table to the feature class using the '&lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//001700000064000000" rel="nofollow noopener noreferrer" target="_blank"&gt;Add Join&lt;/A&gt;&lt;SPAN&gt;' function.&amp;nbsp; Next, run the '&lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00170000004m000000" rel="nofollow noopener noreferrer" target="_blank"&gt;Calculate Field&lt;/A&gt;&lt;SPAN&gt;' function to update the required fields.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;Else: the unmatched records from the table (Table1) are new, so it takes these new records&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can get the unmatched records by comparing a list of Incident IDs from the feature class and table, and then selecting the incidents that are unmatched.&amp;nbsp; Ex:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;fc = "fc"
table = "table1"

fcIncident = []
tableIncident = []

with arcpy.da.SearchCursor(fc, ["INCIDENT_ID"]) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcIncident.append(row[0])

del row, cursor

with arcpy.da.SearchCursor(table, ["INCIDENT_ID"]) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not row[0] in fcIncident:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tableIncident.append(row[0])

del row, cursor

arcpy.MakeTableView_management(table, "tblView")

for ID in tableIncident:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management("tblView", "ADD_TO_SELECTION", "INCIDENT_ID = " + str(ID))&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;which should also add XY fields and a spatialjoin of the geocode result&amp;nbsp; with 3 polygon feature classes (ccd, ced, scd) and updates the necessary&amp;nbsp; fields(ccd_name, ccd_desc, ced_name, ced_desc , scd_name and scd_desc)&amp;nbsp; in the feature class(fc) based on the spatialjoin&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can now &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//002600000006000000" rel="nofollow noopener noreferrer" target="_blank"&gt;geocode&lt;/A&gt;&lt;SPAN&gt; the "tblView", create the Spatial Join, and update the required fields:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.GeocodeAddresses_geocoding("tblView", .....)
FCs = [ccd, ced, scd]
for fc1 in FCs:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SpatialJoin_analysis(fc1, geocodeResult, fc1 + "_join")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(fc, "fcLyr")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(fc1, "fc1Lyr")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddJoin_management("fcLyr", "INCIDENT_ID", "fc1Lyr", "INCIDENT_ID", "KEEP_COMMON")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management("fcLyr", "fc.ccd_name", ....)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management("fcLyr", "fc.ccd_desc", ....)
&amp;nbsp;&amp;nbsp;&amp;nbsp; ....&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note:&amp;nbsp; the field name will change when a join is present.&amp;nbsp; The field name will begin with the feature class/table name.&amp;nbsp; i.e. "parcels.ccd_name"&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:25:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-a-feature-class-based-on-another-table/m-p/250020#M19279</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T12:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: Update a feature class based on another table</title>
      <link>https://community.esri.com/t5/python-questions/update-a-feature-class-based-on-another-table/m-p/250021#M19280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks, I am still getting an AttributeError (AttributeError: 'Cursor' object has no attribute). Also will the arcpy.da.SearchCursor function work in the 10 environment?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;SPAN style="font-style:italic;"&gt; If there is a match it then updates the feature class(fc) based on the match from the table(not sure if that makes sense).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;You can accomplish by simply Joining the table to the feature class using the '&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//001700000064000000" rel="nofollow noopener noreferrer" target="_blank"&gt;Add Join&lt;/A&gt;' function.&amp;nbsp; Next, run the '&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00170000004m000000" rel="nofollow noopener noreferrer" target="_blank"&gt;Calculate Field&lt;/A&gt;' function to update the required fields.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;Else: the unmatched records from the table (Table1) are new, so it takes these new records&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;You can get the unmatched records by comparing a list of Incident IDs from the feature class and table, and then selecting the incidents that are unmatched.&amp;nbsp; Ex:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;fc = "fc"
table = "table1"

fcIncident = []
tableIncident = []

with arcpy.da.SearchCursor(fc, ["INCIDENT_ID"]) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcIncident.append(row[0])

del row, cursor

with arcpy.da.SearchCursor(table, ["INCIDENT_ID"]) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not row[0] in fcIncident:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tableIncident.append(row[0])

del row, cursor

arcpy.MakeTableView_management(table, "tblView")

for ID in tableIncident:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management("tblView", "ADD_TO_SELECTION", "INCIDENT_ID = " + str(ID))&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;which should also add XY fields and a spatialjoin of the geocode result&amp;nbsp; with 3 polygon feature classes (ccd, ced, scd) and updates the necessary&amp;nbsp; fields(ccd_name, ccd_desc, ced_name, ced_desc , scd_name and scd_desc)&amp;nbsp; in the feature class(fc) based on the spatialjoin&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;You can now &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//002600000006000000" rel="nofollow noopener noreferrer" target="_blank"&gt;geocode&lt;/A&gt; the "tblView", create the Spatial Join, and update the required fields:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.GeocodeAddresses_geocoding("tblView", .....)
FCs = [ccd, ced, scd]
for fc1 in FCs:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SpatialJoin_analysis(fc1, geocodeResult, fc1 + "_join")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(fc, "fcLyr")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(fc1, "fc1Lyr")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddJoin_management("fcLyr", "INCIDENT_ID", "fc1Lyr", "INCIDENT_ID", "KEEP_COMMON")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management("fcLyr", "fc.ccd_name", ....)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management("fcLyr", "fc.ccd_desc", ....)
&amp;nbsp;&amp;nbsp;&amp;nbsp; ....&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Note:&amp;nbsp; the field name will change when a join is present.&amp;nbsp; The field name will begin with the feature class/table name.&amp;nbsp; i.e. "parcels.ccd_name"&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:25:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-a-feature-class-based-on-another-table/m-p/250021#M19280</guid>
      <dc:creator>TimBash</dc:creator>
      <dc:date>2021-12-11T12:25:51Z</dc:date>
    </item>
  </channel>
</rss>

