<?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: I need help on the Update Cursor function in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409103#M32276</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have issues with dropping my pdf output in the specified destination output folder from my code below, it does create the pdf output though, but never drops it in the specified destination folder&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;fc = "Parcels"
field = "Block_No"
cursor = arcpy.SearchCursor(fc)
for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.getValue(field)
val = row.getValue(field)
field = "Plot_No"
cursor = arcpy.SearchCursor(fc)
for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.getValue(field)
val2 = row.getValue(field)
outName = "Block" + str(val) + "Plot_" + str(val2)
outName1 = str(val) + "Plot_" + str(val2) + ".pdf"
arcpy.CreateFolder_management("C:\GIS",outName)
arcpy.mapping.ExportToPDF(mxd,"C:\GIS\outName\outName1)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions? Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 18:35:43 GMT</pubDate>
    <dc:creator>OLANIYANOLAKUNLE</dc:creator>
    <dc:date>2021-12-11T18:35:43Z</dc:date>
    <item>
      <title>I need help on the Update Cursor function</title>
      <link>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409061#M32234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Im trying to update a field called "GENERATED" with an attribute called "GENERATED" every time i autogenerate a map, i constructed this script and it is not updating and i didnt see an error(s)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;rows = arcpy.UpdateCursor("Parcels",'[OBJECTID] = "1"')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;row = rows.next()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while row:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setvalue(GENERATED, GENERATED)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = rows.next()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please any suggestions. Im desperate. Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 14:27:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409061#M32234</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2012-08-23T14:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: I need help on the Update Cursor function</title>
      <link>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409062#M32235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I suspect the naming is throwing it off, if GENERATED is the field name, it looks like you're trying to set the value equal to itself.&amp;nbsp; Perhaps this will work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;row.setvalue(GENERATED, 'GENERATED')&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;SPAN&gt;That way the function can distinguish between a field and a value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've also had success with:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;row.GENERATED = 'GENERATED'&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 14:46:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409062#M32235</guid>
      <dc:creator>ChristopherThompson</dc:creator>
      <dc:date>2012-08-23T14:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: I need help on the Update Cursor function</title>
      <link>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409063#M32236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

rows = arcpy.UpdateCursor("Parcels", "[OBJECTID] = 1")

for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue("GENERATED", "GENERATED")
&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You shouldn't have quotes around your objectid query selection. Also not sure if you have assigned GENERATED as a variable, but if you haven't you will need quotes. Also make sure you are using the right field delimiters for your OBJECTID field.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:35:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409063#M32236</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-11T18:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: I need help on the Update Cursor function</title>
      <link>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409064#M32237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;First off, with an arcpy cursor you don't use .next() in a while loop,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;you simply itterate the cursor:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-style:italic;"&gt;...do stuff&lt;/SPAN&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your query string looks problematic&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'[OBJECTID] = "1"'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;should be something like&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'"OBJECTID" = \'1\''&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;using double quotes on the field instead of bracket delimiters and&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;single quotes on the string (or no quotes it it is not a string)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The single quotes around the string have to be escaped with a backslash so&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;you can wrap the whole query in single quotes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;OR you could wrap it all in tripple quotes and not escape....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...three simultaneous answers. that must get some sort of prize.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:35:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409064#M32237</guid>
      <dc:creator>markdenil</dc:creator>
      <dc:date>2021-12-11T18:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: I need help on the Update Cursor function</title>
      <link>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409065#M32238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;...three simultaneous answers. that must get some sort of prize.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The trifecta crown.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 15:54:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409065#M32238</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-08-23T15:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: I need help on the Update Cursor function</title>
      <link>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409066#M32239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I might add that your original sytax of .setvalue should in fact be .setValue (case now matters in v10.0 +!!!). also, I think your SQL in the cursor statement was incorrect. Note you ONLY need to use the .setValue() method if your field name is a variable.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This should work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;rows = arcpy.UpdateCursor("Parcels", "OBJECTID = 1")
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.GENERATED = 'GENERATED'
&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)
del row, rows&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Alternately, this should also work, and demonstates the proper use of the .setValue() method:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;generatedFieldName = "GENERATED"
rows = arcpy.UpdateCursor("Parcels", "OBJECTID = 1")
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(generatedFieldName) = 'GENERATED'
&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)
del row, rows&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:35:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409066#M32239</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2021-12-11T18:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: I need help on the Update Cursor function</title>
      <link>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409067#M32240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;For SAG's (American slang), here's the v10.1 equivalent using the new "data access" update cursor syntax:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;fieldList = ["GENERATED"] #list of the field names you want the cursor to return... order is important
rows = arcpy.da.UpdateCursor("Parcels", fieldList, "OBJECTID = 1")
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; row[0] = 'GENERATED' #fields are now refered to in terms of their index in the fieldList
&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:35:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409067#M32240</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2021-12-11T18:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: I need help on the Update Cursor function</title>
      <link>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409068#M32241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for all your response, but can i start an edit session automatically with arcpy script? Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 18:27:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409068#M32241</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2012-08-23T18:27:02Z</dc:date>
    </item>
    <item>
      <title>Re: I need help on the Update Cursor function</title>
      <link>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409069#M32242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thanks for all your response, but can i start an edit session automatically with arcpy script? Thanks&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;No, that would require ArcObjects.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 18:42:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409069#M32242</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-08-23T18:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: I need help on the Update Cursor function</title>
      <link>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409070#M32243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is the new code i constructed:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;rows = arcpy.UpdateCursor("Parcels", "FID = 0")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; for row in rows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setvalue("GENERATED", "GENERATED")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and this is the error message i received:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 2, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\arcobjects\_base.py", line 28, in __getattr__&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise AttributeError("%s" % attr)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AttributeError: setvalue&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 19:24:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409070#M32243</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2012-08-23T19:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: I need help on the Update Cursor function</title>
      <link>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409071#M32244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;As Chris mentioned earlier, you need to have setValue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;rows = arcpy.UpdateCursor("Parcels", "FID = 1")

for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.&lt;STRONG&gt;setValue&lt;/STRONG&gt;("GENERATED", "GENERATED")
&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:35:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409071#M32244</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-11T18:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: I need help on the Update Cursor function</title>
      <link>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409072#M32245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;but can i start an edit session automatically with arcpy script&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Actually, in v10.1, yes you can: &lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000005000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000005000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Although I feel that extra complexity might not be what you actually want to do in this case...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 20:10:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409072#M32245</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2012-08-23T20:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: I need help on the Update Cursor function</title>
      <link>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409073#M32246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;mzcoyle, please there is no difference between the code you pasted and the code i used? Please can you elaborate on the setvalue? Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 20:16:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409073#M32246</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2012-08-23T20:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: I need help on the Update Cursor function</title>
      <link>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409074#M32247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;setvalue vs setValue&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Python is case sensitive... Meaning there is a difference between upper case (V) and lower case (v).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 20:43:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409074#M32247</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2012-08-23T20:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: I need help on the Update Cursor function</title>
      <link>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409075#M32248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I used your code&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rows = arcpy.UpdateCursor("Parcels", "FID = 1")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for row in rows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue("GENERATED", "GENERATED")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i did not get any error but the record was not updated? Any suggestions&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 20:56:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409075#M32248</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2012-08-23T20:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: I need help on the Update Cursor function</title>
      <link>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409076#M32249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Only use setValue() if the field name is a variable.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if your field IS NOT a variable:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;rows = arcpy.UpdateCursor("Parcels", "FID = 1")
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.GENERATED = "GENERATED"
&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)&lt;/PRE&gt;&lt;SPAN&gt;if your field IS a variable:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;myField = "GENERATED"
rows = arcpy.UpdateCursor("Parcels", "FID = 1")
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(myField,"GENERATED")
&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:35:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409076#M32249</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2021-12-11T18:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: I need help on my pdf output</title>
      <link>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409077#M32250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;i want to generate a pdf output by using the arcpy.exporttopdf function, i want the final output to use this nomenclature for naming the pdf output (plot_no.pdf); the plot_no would be derived from an attribute value under the field named plot_no in the attribute table. Please do you have any suggestions. Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 21:02:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409077#M32250</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2012-08-23T21:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: I need help on the Update Cursor function</title>
      <link>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409078#M32251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks all i got it with all your suggestions, what happened was that i had to start an edit session to be able to see the changes. With this i have some layers from a parcel fabric within my dataframe which makes it difficult for me to use the edit = arcpy.da.Editor(workspace) it throws this error - can not open workspace. Any suggestion would go a long way. Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 21:12:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409078#M32251</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2012-08-23T21:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: I need help on the Update Cursor function</title>
      <link>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409079#M32252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Im trying to automatically get the system time and date updated with the update cursor script, this is my script and the error&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;myField = "Date_Gener"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; rows = arcpy.UpdateCursor("Parcels")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; for row in rows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(myField,'Date (&amp;nbsp; )') &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 2, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\arcobjects\arcobjects.py", line 1007, in setValue&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return convertArcObjectToPythonObject(self._arc_object.SetValue(*gp_fixargs(args)))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RuntimeError: ERROR 999999: Error executing function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The value type is incompatible with the field type. [Date_Gener]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions? Please....&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 22:30:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409079#M32252</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2012-08-23T22:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: I need help on the Update Cursor function</title>
      <link>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409080#M32253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; &lt;BR /&gt;myField = "Date_Gener"&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; rows = arcpy.UpdateCursor("Parcels")&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; for row in rows:&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(myField,'Date (&amp;nbsp; )') &lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why not get the date as a string and use the Calculate Field tool? This is easier and much faster than a cursor, even the newfangled arcpy.da flavor.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import datetime
Today = str(datetime.date.today())
arcpy.CalculateField_management("Parcels","date_Gener","'" + Today + "'","PYTHON")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This will only calculate the value for selected rows of the layer "Parcels".&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:35:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-help-on-the-update-cursor-function/m-p/409080#M32253</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-11T18:35:21Z</dc:date>
    </item>
  </channel>
</rss>

