<?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: Python add-in help - restricting da.SearchCursor and da.UpdateCursor in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-add-in-help-restricting-da-searchcursor-and/m-p/358996#M28325</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you tried validating the record count using arcpy.GetCount (&lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//0017000000n7000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//0017000000n7000000&lt;/A&gt;&lt;SPAN&gt;)? GetCount respects any selection applied, and if no selection is applied then it returns the full feature count. Perhaps you can test the result and see if the count is equal to exactly one? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I have a small add-in that I use for a building footprints map. Essentially, the add-in reads the data from the parcel layer, and copies the data to the buildings layer (I use this when I have to 'split' a building that lies over multiple parcels).&lt;BR /&gt;&lt;BR /&gt;The code is set up to work with one (manually selected) parcel and one footprint, no more. However, if I were to click the add-in when no parcel or footprint was selected, it assigns the last record of the parcel data to every footprint! If I am in an edit session, it's OK, but I would like to let other people use this add-in.&lt;BR /&gt;&lt;BR /&gt;I understand why I get this behavior (the search/update cursor are looping through every record if none is selected) Is there some pre-script logic I can add to make sure that only one record is updated?&lt;BR /&gt;&lt;BR /&gt;Here is my code:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
import pythonaddins
import webbrowser
import threading

mxd = arcpy.mapping.MapDocument("CURRENT")
layerList = arcpy.mapping.ListLayers(mxd)
tableList = arcpy.mapping.ListTableViews(mxd)
for layer in layerList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if "Footprints_Edit" in layer.name:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; footprints_fc = layer
&amp;nbsp;&amp;nbsp;&amp;nbsp; if "Parcels_Edit" in layer.name:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parcels_fc = layer
&amp;nbsp;&amp;nbsp;&amp;nbsp; if "Address" in layer.name:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address_fc = layer
for table in tableList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if "Assessing" in table.name:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; assessing_table = table
&amp;nbsp;&amp;nbsp;&amp;nbsp; if "Condos" in table.name:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; condo_table = table

def rows_as_update_dicts(cursor):
&amp;nbsp;&amp;nbsp;&amp;nbsp; colnames = cursor.fields
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row_object = dict(zip(colnames, row))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yield row_object
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow([row_object[colname] for colname in colnames])

class assignparceldata(object):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for building_footprints_Addin_addin.assignParcelData (Button)"""
&amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.checked = False
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onClick(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parcelfields = ["PIN","PADDRESS"]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.SearchCursor(parcels_fc,parcelfields) as rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:
&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;&amp;nbsp; new_pin = row[0]
&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;&amp;nbsp; new_paddress = row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Assigning parcel: PIN is %s, Address is %s" % (new_pin,new_paddress)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; footprint_fields = ["BUILDINGID", "TAXID","BADDRESS"]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(footprints_fc,footprint_fields) as brows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows_as_update_dicts(brows):
&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;&amp;nbsp; row['TAXID'] = new_pin
&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;&amp;nbsp; row['BADDRESS'] = new_paddress
&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;&amp;nbsp; print "Updating building footprint %d with parcel info: PIN is (%s), address is (%s)" % (row['BUILDINGID'], new_pin, new_paddress)

&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 16:45:51 GMT</pubDate>
    <dc:creator>DouglasSands</dc:creator>
    <dc:date>2021-12-11T16:45:51Z</dc:date>
    <item>
      <title>Python add-in help - restricting da.SearchCursor and da.UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/python-add-in-help-restricting-da-searchcursor-and/m-p/358995#M28324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a small add-in that I use for a building footprints map. Essentially, the add-in reads the data from the parcel layer, and copies the data to the buildings layer (I use this when I have to 'split' a building that lies over multiple parcels).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code is set up to work with one (manually selected) parcel and one footprint, no more. However, if I were to click the add-in when no parcel or footprint was selected, it assigns the last record of the parcel data to every footprint! If I am in an edit session, it's OK, but I would like to let other people use this add-in.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I understand why I get this behavior (the search/update cursor are looping through every record if none is selected) Is there some pre-script logic I can add to make sure that only one record is updated?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import arcpy
import pythonaddins
import webbrowser
import threading

mxd = arcpy.mapping.MapDocument("CURRENT")
layerList = arcpy.mapping.ListLayers(mxd)
tableList = arcpy.mapping.ListTableViews(mxd)
for layer in layerList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if "Footprints_Edit" in layer.name:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; footprints_fc = layer
&amp;nbsp;&amp;nbsp;&amp;nbsp; if "Parcels_Edit" in layer.name:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parcels_fc = layer
&amp;nbsp;&amp;nbsp;&amp;nbsp; if "Address" in layer.name:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address_fc = layer
for table in tableList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if "Assessing" in table.name:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; assessing_table = table
&amp;nbsp;&amp;nbsp;&amp;nbsp; if "Condos" in table.name:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; condo_table = table

def rows_as_update_dicts(cursor):
&amp;nbsp;&amp;nbsp;&amp;nbsp; colnames = cursor.fields
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row_object = dict(zip(colnames, row))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yield row_object
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow([row_object[colname] for colname in colnames])

class assignparceldata(object):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for building_footprints_Addin_addin.assignParcelData (Button)"""
&amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.checked = False
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onClick(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parcelfields = ["PIN","PADDRESS"]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.SearchCursor(parcels_fc,parcelfields) as rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:
&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;&amp;nbsp; new_pin = row[0]
&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;&amp;nbsp; new_paddress = row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Assigning parcel: PIN is %s, Address is %s" % (new_pin,new_paddress)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; footprint_fields = ["BUILDINGID", "TAXID","BADDRESS"]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(footprints_fc,footprint_fields) as brows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows_as_update_dicts(brows):
&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;&amp;nbsp; row['TAXID'] = new_pin
&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;&amp;nbsp; row['BADDRESS'] = new_paddress
&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;&amp;nbsp; print "Updating building footprint %d with parcel info: PIN is (%s), address is (%s)" % (row['BUILDINGID'], new_pin, new_paddress)

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Oct 2013 12:32:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-add-in-help-restricting-da-searchcursor-and/m-p/358995#M28324</guid>
      <dc:creator>JamesMcBroom1</dc:creator>
      <dc:date>2013-10-08T12:32:07Z</dc:date>
    </item>
    <item>
      <title>Re: Python add-in help - restricting da.SearchCursor and da.UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/python-add-in-help-restricting-da-searchcursor-and/m-p/358996#M28325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you tried validating the record count using arcpy.GetCount (&lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//0017000000n7000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//0017000000n7000000&lt;/A&gt;&lt;SPAN&gt;)? GetCount respects any selection applied, and if no selection is applied then it returns the full feature count. Perhaps you can test the result and see if the count is equal to exactly one? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I have a small add-in that I use for a building footprints map. Essentially, the add-in reads the data from the parcel layer, and copies the data to the buildings layer (I use this when I have to 'split' a building that lies over multiple parcels).&lt;BR /&gt;&lt;BR /&gt;The code is set up to work with one (manually selected) parcel and one footprint, no more. However, if I were to click the add-in when no parcel or footprint was selected, it assigns the last record of the parcel data to every footprint! If I am in an edit session, it's OK, but I would like to let other people use this add-in.&lt;BR /&gt;&lt;BR /&gt;I understand why I get this behavior (the search/update cursor are looping through every record if none is selected) Is there some pre-script logic I can add to make sure that only one record is updated?&lt;BR /&gt;&lt;BR /&gt;Here is my code:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
import pythonaddins
import webbrowser
import threading

mxd = arcpy.mapping.MapDocument("CURRENT")
layerList = arcpy.mapping.ListLayers(mxd)
tableList = arcpy.mapping.ListTableViews(mxd)
for layer in layerList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if "Footprints_Edit" in layer.name:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; footprints_fc = layer
&amp;nbsp;&amp;nbsp;&amp;nbsp; if "Parcels_Edit" in layer.name:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parcels_fc = layer
&amp;nbsp;&amp;nbsp;&amp;nbsp; if "Address" in layer.name:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address_fc = layer
for table in tableList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if "Assessing" in table.name:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; assessing_table = table
&amp;nbsp;&amp;nbsp;&amp;nbsp; if "Condos" in table.name:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; condo_table = table

def rows_as_update_dicts(cursor):
&amp;nbsp;&amp;nbsp;&amp;nbsp; colnames = cursor.fields
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row_object = dict(zip(colnames, row))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yield row_object
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow([row_object[colname] for colname in colnames])

class assignparceldata(object):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for building_footprints_Addin_addin.assignParcelData (Button)"""
&amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.checked = False
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onClick(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parcelfields = ["PIN","PADDRESS"]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.SearchCursor(parcels_fc,parcelfields) as rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:
&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;&amp;nbsp; new_pin = row[0]
&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;&amp;nbsp; new_paddress = row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Assigning parcel: PIN is %s, Address is %s" % (new_pin,new_paddress)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; footprint_fields = ["BUILDINGID", "TAXID","BADDRESS"]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(footprints_fc,footprint_fields) as brows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows_as_update_dicts(brows):
&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;&amp;nbsp; row['TAXID'] = new_pin
&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;&amp;nbsp; row['BADDRESS'] = new_paddress
&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;&amp;nbsp; print "Updating building footprint %d with parcel info: PIN is (%s), address is (%s)" % (row['BUILDINGID'], new_pin, new_paddress)

&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:45:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-add-in-help-restricting-da-searchcursor-and/m-p/358996#M28325</guid>
      <dc:creator>DouglasSands</dc:creator>
      <dc:date>2021-12-11T16:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Python add-in help - restricting da.SearchCursor and da.UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/python-add-in-help-restricting-da-searchcursor-and/m-p/358997#M28326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I did not know about GetCount. That is exactly what I am looking for. Thanks for pointing that out to me!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Oct 2013 13:07:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-add-in-help-restricting-da-searchcursor-and/m-p/358997#M28326</guid>
      <dc:creator>JamesMcBroom1</dc:creator>
      <dc:date>2013-10-08T13:07:23Z</dc:date>
    </item>
  </channel>
</rss>

