<?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 attribute based on SQL table? in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/update-attribute-based-on-sql-table/m-p/1065793#M25579</link>
    <description>&lt;P&gt;Maybe something like this to get you started...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;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"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 07 Jun 2021 22:49:39 GMT</pubDate>
    <dc:creator>CCWeedcontrol</dc:creator>
    <dc:date>2021-06-07T22:49:39Z</dc:date>
    <item>
      <title>Update attribute based on SQL table?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/update-attribute-based-on-sql-table/m-p/1063692#M25574</link>
      <description>&lt;P&gt;I have a python script that runs periodically that updates a "status" attribute based on location relative to another feature class.&lt;/P&gt;&lt;P&gt;I have a SQL table that has a list of individual exceptions, where the status is not determined solely by location.&amp;nbsp;&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jun 2021 16:25:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/update-attribute-based-on-sql-table/m-p/1063692#M25574</guid>
      <dc:creator>LLCCG</dc:creator>
      <dc:date>2021-06-01T16:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: Update attribute based on SQL table?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/update-attribute-based-on-sql-table/m-p/1065793#M25579</link>
      <description>&lt;P&gt;Maybe something like this to get you started...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;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"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jun 2021 22:49:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/update-attribute-based-on-sql-table/m-p/1065793#M25579</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-06-07T22:49:39Z</dc:date>
    </item>
  </channel>
</rss>

