<?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: Search and Update Cursors in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/search-and-update-cursors/m-p/756739#M58376</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a use for the update and search cursors.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;first question:&amp;nbsp; why are you using the os.path in your script instead of the addjoin management function?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Alicia&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Oct 2013 17:01:20 GMT</pubDate>
    <dc:creator>AliciaMein</dc:creator>
    <dc:date>2013-10-10T17:01:20Z</dc:date>
    <item>
      <title>Search and Update Cursors</title>
      <link>https://community.esri.com/t5/python-questions/search-and-update-cursors/m-p/756737#M58374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I need to use search and update cursors to get the values from one feature class to another. Before this code worked because I had only one record to be updated, but now I may have more than one. How can I change it to let it update many records? Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; countycode = tuple(arcpy.da.SearchCursor("Countieslayer", "FIPS_TXT"))[0][0] &amp;nbsp;&amp;nbsp;&amp;nbsp; urows = arcpy.da.UpdateCursor("Stewardship", "County") &amp;nbsp;&amp;nbsp;&amp;nbsp; for urow in urows: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urow[0] = countycode &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urows.updateRow(urow)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Oct 2013 19:40:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/search-and-update-cursors/m-p/756737#M58374</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-10-09T19:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: Search and Update Cursors</title>
      <link>https://community.esri.com/t5/python-questions/search-and-update-cursors/m-p/756738#M58375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This worked, I just had to create temporary layers, instead of feature classes&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# Create new field mappings and addd both feature classes&amp;nbsp; fieldmappings = arcpy.FieldMappings() fieldmappings.addTable(Input_Polygons) fieldmappings.addTable(Counties)&amp;nbsp; # create output feature for spatial join outstewardshipcounties = os.path.join(arcpy.env.scratchGDB, "StewardshipCounties")&amp;nbsp; #run spatial joint tool&amp;nbsp; arcpy.SpatialJoin_analysis(Input_Polygons, Counties, outstewardshipcounties , "#", "#", fieldmappings, "HAVE_THEIR_CENTER_IN")&amp;nbsp; #create dictionary&amp;nbsp; path_dict = { } rows = arcpy.SearchCursor(outstewardshipcounties) for row in rows: &amp;nbsp;&amp;nbsp;&amp;nbsp; keyrow = row.getValue("ObjectID") &amp;nbsp;&amp;nbsp;&amp;nbsp; valrow = row.getValue("FIPS_TXT") &amp;nbsp;&amp;nbsp;&amp;nbsp; path_dict[keyrow] = valrow&amp;nbsp; urows = arcpy.UpdateCursor(Input_Polygons) for urow in urows: &amp;nbsp;&amp;nbsp;&amp;nbsp; upkey = urow.getValue("ObjectID") &amp;nbsp;&amp;nbsp;&amp;nbsp; if upkey in path_dict: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urow.setValue("County", path_dict[upkey]) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urows.updateRow(urow) del row, rows, urow, urows&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2013 13:47:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/search-and-update-cursors/m-p/756738#M58375</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-10-10T13:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: Search and Update Cursors</title>
      <link>https://community.esri.com/t5/python-questions/search-and-update-cursors/m-p/756739#M58376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a use for the update and search cursors.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;first question:&amp;nbsp; why are you using the os.path in your script instead of the addjoin management function?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Alicia&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2013 17:01:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/search-and-update-cursors/m-p/756739#M58376</guid>
      <dc:creator>AliciaMein</dc:creator>
      <dc:date>2013-10-10T17:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: Search and Update Cursors</title>
      <link>https://community.esri.com/t5/python-questions/search-and-update-cursors/m-p/756740#M58377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Add join is to join layers and the os.path.join is just adding the strings to create a layer in that scratch workspace&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2013 17:06:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/search-and-update-cursors/m-p/756740#M58377</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-10-10T17:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: Search and Update Cursors</title>
      <link>https://community.esri.com/t5/python-questions/search-and-update-cursors/m-p/756741#M58378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I understand the Arcpy module and navigate the help at esri well but is there documentation on the os module?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I will post a new thread for my update and search cursor issue and look forward to seeing a reply from you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Alicia&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2013 18:45:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/search-and-update-cursors/m-p/756741#M58378</guid>
      <dc:creator>AliciaMein</dc:creator>
      <dc:date>2013-10-10T18:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Search and Update Cursors</title>
      <link>https://community.esri.com/t5/python-questions/search-and-update-cursors/m-p/756742#M58379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is some info that should help you:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//004000000008000000.htm"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//004000000008000000.htm&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2013 19:06:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/search-and-update-cursors/m-p/756742#M58379</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-10-10T19:06:03Z</dc:date>
    </item>
  </channel>
</rss>

