<?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: Problem with where clause and Update Cursor in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/problem-with-where-clause-and-update-cursor/m-p/752843#M58133</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi David,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure if this has anything to do with it, but I notice in your original post that you obtain your "SubmitDate" through:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;SubmitDate = arcpy.GetParameter&lt;STRONG&gt;AsText&lt;/STRONG&gt;(1)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your "SubmitDate" is a string. I don't know how you have defined the type of your field "SUBMITTALDATE", but if it is a date field, it may be better to provide an actual date. To convert a string to a datetime object see snippet below (but, you need to know the format how it's specified):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
from datetime import datetime

submitDate = '24-9-2013'
dateObj = datetime.strptime(submitDate,'%d-%m-%Y')

submitDate = '9/24/2013'
dateObj = datetime.strptime(submitDate,'%m/%d/%Y')
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;More info on syntax: &lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior" rel="nofollow noopener noreferrer" target="_blank"&gt;http://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The alternative could be to read it as an object if it's provided as a date:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;SubmitDate = arcpy.&lt;STRONG&gt;GetParameter&lt;/STRONG&gt;(1)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See also the Help: &lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018v00000038000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//018v00000038000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 07:57:41 GMT</pubDate>
    <dc:creator>XanderBakker</dc:creator>
    <dc:date>2021-12-12T07:57:41Z</dc:date>
    <item>
      <title>Problem with where clause and Update Cursor</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-where-clause-and-update-cursor/m-p/752835#M58125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am working on a script that will allow users to select a project from a pull down list in the tool and then update the status.&amp;nbsp; I am using an update cursor with a where clause to update the attributes for all of the polygons with the same name.&amp;nbsp; When I try to run the script I get an error message that the where clause is not a string. Here is the code the where clause is in bold:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# Import arcpy and date time module import arcpy import datetime&amp;nbsp;&amp;nbsp; # Local variables: today = datetime.date.today() mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "Layers") [0] parcels = arcpy.mapping.ListLayers(mxd, "Parcels", df) [0]&amp;nbsp;&amp;nbsp; # Geting user input for project name, status, type, submital date and planner name ProjectName = arcpy.GetParameterAsText(0) ProjStatus = arcpy.GetParameterAsText(2) SubmitDate = arcpy.GetParameterAsText(1) DevelopeType = arcpy.GetParameterAsText(3) PlannerName = arcpy.GetParameterAsText(4)&amp;nbsp;&amp;nbsp; PlanningProjectTracking = "C:\\David Projects\\Planning Project Tracking\\PythonProjectTracking.mdb\\PlanningProjectTracking"&amp;nbsp;&amp;nbsp; whereClause = "[ProjectName] = '{0}'".format(ProjectName)&amp;nbsp;&amp;nbsp; #Used update cursor to create update project tracking records. Ucursor = arcpy.da.UpdateCursor(PlanningProjectTracking, whereClause, ["PROJECTNAME","STATUS","SUBMITTALDATE","DEVELOPEMENTTYPE","PLANNER","EDITDATE"]) for row in Ucursor: &amp;nbsp;&amp;nbsp; row.setValue (ProjectName,ProjStatus,SubmitDate,DevelopeType,PlannerName,today) &amp;nbsp;&amp;nbsp; Ucursor.updateRow(row) arcpy.RefreshActiveView()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Sep 2013 20:24:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-where-clause-and-update-cursor/m-p/752835#M58125</guid>
      <dc:creator>DavidDenham</dc:creator>
      <dc:date>2013-09-20T20:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with where clause and Update Cursor</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-where-clause-and-update-cursor/m-p/752836#M58126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You've mixed up the argument order, the list of fields goes &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;before&lt;/SPAN&gt;&lt;SPAN&gt; the where clause. In addition, you're mixing up your cursor models. There's no &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;row.setValue&lt;/SPAN&gt;&lt;SPAN&gt; in &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;da.UpdateCursor&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Ucursor = arcpy.da.UpdateCursor(PlanningProjectTracking, ["PROJECTNAME","STATUS","SUBMITTALDATE","DEVELOPEMENTTYPE","PLANNER","EDITDATE"], whereClause) for row in Ucursor: &amp;nbsp;&amp;nbsp; Ucursor.updateRow([ProjectName,ProjStatus,SubmitDate,DevelopeType,PlannerName,today])&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Sep 2013 20:37:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-where-clause-and-update-cursor/m-p/752836#M58126</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2013-09-20T20:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with where clause and Update Cursor</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-where-clause-and-update-cursor/m-p/752837#M58127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;You've mixed up the argument order, the list of fields goes &lt;SPAN style="font-style:italic;"&gt;before&lt;/SPAN&gt; the where clause. In addition, you're mixing up your cursor models. There's no &lt;SPAN style="font-family:Courier New;"&gt;row.setValue&lt;/SPAN&gt; in &lt;SPAN style="font-family:Courier New;"&gt;da.UpdateCursor&lt;/SPAN&gt;.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Ucursor = arcpy.da.UpdateCursor(PlanningProjectTracking, ["PROJECTNAME","STATUS","SUBMITTALDATE","DEVELOPEMENTTYPE","PLANNER","EDITDATE"], whereClause)
for row in Ucursor:
&amp;nbsp;&amp;nbsp; Ucursor.updateRow([ProjectName,ProjStatus,SubmitDate,DevelopeType,PlannerName,today])&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your suggestion, but I checked the &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018v00000064000000" rel="nofollow noopener noreferrer" target="_blank"&gt;update cursor page &lt;/A&gt;&lt;SPAN&gt;on the 10.1 resource center and the syntax that they show is &lt;/SPAN&gt;&lt;STRONG&gt;UpdateCursor (dataset, {where_clause}, {spatial_reference}, {fields}, {sort_field})&lt;/STRONG&gt;&lt;SPAN&gt;.&amp;nbsp; I tried to use what you suggested, but it still failed to run with an error message &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;&lt;STRONG&gt;TypeError: updateRow() takes exactly 1 argument (6 given&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;).&amp;nbsp; I tried to include "",&amp;nbsp; to hold the place for the spatial reference, but that did not work either.&amp;nbsp; I will have to see if I can select the features first and then update just the selected features.&amp;nbsp; This is not the way that I would like to do it since I would like to keep my code as simple as possible.&amp;nbsp; I&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:57:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-where-clause-and-update-cursor/m-p/752837#M58127</guid>
      <dc:creator>DavidDenham</dc:creator>
      <dc:date>2021-12-12T07:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with where clause and Update Cursor</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-where-clause-and-update-cursor/m-p/752838#M58128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN style="font-family:Courier New;"&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000014000000"&gt;arcpy.da.UpdateCursor&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt; and &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#/Cursor/018z0000009r000000/"&gt;arcpy.UpdateCursor&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt; are two different things, your script looks like it's creating an &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;arcpy.da.UpdateCursor&lt;/SPAN&gt;&lt;SPAN&gt; but treating it like an &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;arcpy.UpdateCursor&lt;/SPAN&gt;&lt;SPAN&gt;. You may be able to get away with your original script just by doing this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;Ucursor = arcpy.UpdateCursor(PlanningProjectTracking, whereClause, ["PROJECTNAME","STATUS","SUBMITTALDATE","DEVELOPEMENTTYPE","PLANNER","EDITDATE"])&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Sep 2013 15:14:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-where-clause-and-update-cursor/m-p/752838#M58128</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2013-09-23T15:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with where clause and Update Cursor</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-where-clause-and-update-cursor/m-p/752839#M58129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;SPAN style="font-family:Courier New;"&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000014000000" rel="nofollow noopener noreferrer" target="_blank"&gt;arcpy.da.UpdateCursor&lt;/A&gt;&lt;/SPAN&gt; and &lt;SPAN style="font-family:Courier New;"&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#/Cursor/018z0000009r000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;arcpy.UpdateCursor&lt;/A&gt;&lt;/SPAN&gt; are two different things, your script looks like it's creating an &lt;SPAN style="font-family:Courier New;"&gt;arcpy.da.UpdateCursor&lt;/SPAN&gt; but treating it like an &lt;SPAN style="font-family:Courier New;"&gt;arcpy.UpdateCursor&lt;/SPAN&gt;. You may be able to get away with your original script just by doing this:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Ucursor = arcpy.UpdateCursor(PlanningProjectTracking, whereClause, ["PROJECTNAME","STATUS","SUBMITTALDATE","DEVELOPEMENTTYPE","PLANNER","EDITDATE"])&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the help, but now I am getting an error message &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;&lt;STRONG&gt;AttributeError: Object: Error in parsing arguments for UpdateCurso&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;.&amp;nbsp; Here is the code that I changed since the last time I posted:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Ucursor = arcpy.UpdateCursor(PlanningProjectTracking, whereClause, "", ["PROJECTNAME","STATUS","SUBMITTALDATE","DEVELOPEMENTTYPE","PLANNER","EDITDATE"])for row in Ucursor:
&amp;nbsp;&amp;nbsp; row.setValue (ProjectName,ProjStatus,SubmitDate,DevelopeType,PlannerName,today)
&amp;nbsp;&amp;nbsp; Ucursor.updateRow(row)
arcpy.RefreshActiveView()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:57:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-where-clause-and-update-cursor/m-p/752839#M58129</guid>
      <dc:creator>DavidDenham</dc:creator>
      <dc:date>2021-12-12T07:57:31Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with where clause and Update Cursor</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-where-clause-and-update-cursor/m-p/752840#M58130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Ucursor = arcpy.UpdateCursor(PlanningProjectTracking, whereClause, "", ["PROJECTNAME","STATUS","SUBMITTALDATE","DEVELOPEMENTTYPE","PLANNER","EDITDATE"])for row in Ucursor:
&amp;nbsp;&amp;nbsp; for fieldname, value in [('PROJECTNAME', ProjectName), ('STATUS', ProjStatus), ('SUBMITTALDATE', SubmitDate), ('DEVELOPEMENTTYPE', DevelopeType), ('PLANNER', PlannerName), ('EDITDATE', today)]:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(fieldname, value)
&amp;nbsp;&amp;nbsp; Ucursor.updateRow(row)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:57:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-where-clause-and-update-cursor/m-p/752840#M58130</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2021-12-12T07:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with where clause and Update Cursor</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-where-clause-and-update-cursor/m-p/752841#M58131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Ucursor = arcpy.UpdateCursor(PlanningProjectTracking, whereClause, "", ["PROJECTNAME","STATUS","SUBMITTALDATE","DEVELOPEMENTTYPE","PLANNER","EDITDATE"])for row in Ucursor:
&amp;nbsp;&amp;nbsp; for fieldname, value in [('PROJECTNAME', ProjectName), ('STATUS', ProjStatus), ('SUBMITTALDATE', SubmitDate), ('DEVELOPEMENTTYPE', DevelopeType), ('PLANNER', PlannerName), ('EDITDATE', today)]:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(fieldname, value)
&amp;nbsp;&amp;nbsp; Ucursor.updateRow(row)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried that out and I received a syntax error with: &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Ucursor = arcpy.UpdateCursor(PlanningProjectTracking, whereClause, "", ["PROJECTNAME","STATUS","SUBMITTALDATE","DEVELOPEMENTTYPE","PLANNER","EDITDATE"])for row in Ucursor:&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I thought that the for row in Ucursor: was supposed to be on the next line, but when I tried that I still had an error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="color:#ff0000;"&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color:#ff0000;"&gt;&amp;nbsp; File "C:\David Projects\Planning Project Tracking\PythonUpdateProjectTracking.py", line 37, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color:#ff0000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Ucursor = arcpy.UpdateCursor(PlanningProjectTracking, whereClause, "", ["PROJECTNAME","STATUS","SUBMITTALDATE","DEVELOPEMENTTYPE","PLANNER","EDITDATE"])&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color:#ff0000;"&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\__init__.py", line 1165, in UpdateCursor&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color:#ff0000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return gp.updateCursor(dataset, where_clause, spatial_reference, fields, sort_fields)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color:#ff0000;"&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\geoprocessing\_base.py", line 364, in updateCursor&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color:#ff0000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; self._gp.UpdateCursor(*gp_fixargs(args, True)))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color:#ff0000;"&gt;AttributeError: Object: Error in parsing arguments for UpdateCursor&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color:#ff0000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color:#ff0000;"&gt;Failed to execute (UpdateProjectTracking).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't mind trying to use the selecting by attribute first, but I hate not knowing why this is not working.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:57:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-where-clause-and-update-cursor/m-p/752841#M58131</guid>
      <dc:creator>DavidDenham</dc:creator>
      <dc:date>2021-12-12T07:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with where clause and Update Cursor</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-where-clause-and-update-cursor/m-p/752842#M58132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The initial &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;arcpy.da&lt;/SPAN&gt;&lt;SPAN&gt; solution I provided should have worked if it had been correctly copied. The updateRow() call needs the list of values to be in a &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;[list, like, this]&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Either do this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;with arcpy.da.UpdateCursor(PlanningProjectTracking, ["PROJECTNAME","STATUS","SUBMITTALDATE","DEVELOPEMENTTYPE","PLANNER","EDITDATE"], whereClause) as Ucursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in Ucursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Ucursor.updateRow([ProjectName,ProjStatus,SubmitDate,DevelopeType,PlannerName,today])
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;or&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Ucursor = arcpy.UpdateCursor(PlanningProjectTracking, whereClause)
for row in Ucursor:
&amp;nbsp;&amp;nbsp; for fieldname, value in (('PROJECTNAME', ProjectName),
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ('STATUS', ProjStatus),
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ('SUBMITTALDATE', SubmitDate),
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ('DEVELOPEMENTTYPE', DevelopeType),
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ('PLANNER', PlannerName),
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ('EDITDATE', today)):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(fieldname, value)
&amp;nbsp;&amp;nbsp; Ucursor.updateRow(row)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You do not need to specify all the arguments in the cursor. If a parameter is marked as optional in the documentation, you can omit it.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:57:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-where-clause-and-update-cursor/m-p/752842#M58132</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2021-12-12T07:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with where clause and Update Cursor</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-where-clause-and-update-cursor/m-p/752843#M58133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi David,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure if this has anything to do with it, but I notice in your original post that you obtain your "SubmitDate" through:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;SubmitDate = arcpy.GetParameter&lt;STRONG&gt;AsText&lt;/STRONG&gt;(1)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your "SubmitDate" is a string. I don't know how you have defined the type of your field "SUBMITTALDATE", but if it is a date field, it may be better to provide an actual date. To convert a string to a datetime object see snippet below (but, you need to know the format how it's specified):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
from datetime import datetime

submitDate = '24-9-2013'
dateObj = datetime.strptime(submitDate,'%d-%m-%Y')

submitDate = '9/24/2013'
dateObj = datetime.strptime(submitDate,'%m/%d/%Y')
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;More info on syntax: &lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior" rel="nofollow noopener noreferrer" target="_blank"&gt;http://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The alternative could be to read it as an object if it's provided as a date:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;SubmitDate = arcpy.&lt;STRONG&gt;GetParameter&lt;/STRONG&gt;(1)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See also the Help: &lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018v00000038000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//018v00000038000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:57:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-where-clause-and-update-cursor/m-p/752843#M58133</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-12T07:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with where clause and Update Cursor</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-where-clause-and-update-cursor/m-p/752844#M58134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am going to blame this on sleep deprivation from staying up with the my kids.&amp;nbsp; I finally realized what&amp;nbsp; you said in your first reply and switched from using the old arcpy.UpdateCursor and used the arcpy.da.UpdateCursor instead.&amp;nbsp; Then I used the parameters in the correct order and the tool worked fine.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

# Import arcpy and date time module
import arcpy
import datetime


# Local variables:
today = datetime.date.today()
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "Layers") [0]


ProjectTracking = arcpy.mapping.ListLayers(mxd, "PlanningProjectTracking", df) [0]


# Geting user input for project name, status, type, submital date and planner name
ProjectName = arcpy.GetParameterAsText(0)
ProjStatus = arcpy.GetParameterAsText(2)
SubmitDate = arcpy.GetParameterAsText(1)
DevelopeType = arcpy.GetParameterAsText(3)
PlannerName = arcpy.GetParameterAsText(4)


#Set variable to hold SQL statement to query out project to update
whereClause = "[ProjectName] = '{0}'".format(ProjectName)


#Used update cursor to create update project tracking records.
Ucursor = arcpy.da.UpdateCursor(ProjectTracking,["PROJECTNAME","STATUS","SUBMITTALDATE","DEVELOPEMENTTYPE","PLANNER","EDITDATE"],whereClause)
for row in Ucursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; irow = (ProjectName,ProjStatus,SubmitDate,DevelopeType,PlannerName,today)
&amp;nbsp;&amp;nbsp;&amp;nbsp; Ucursor.updateRow(irow)
arcpy.RefreshActiveView()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:57:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-where-clause-and-update-cursor/m-p/752844#M58134</guid>
      <dc:creator>DavidDenham</dc:creator>
      <dc:date>2021-12-12T07:57:44Z</dc:date>
    </item>
  </channel>
</rss>

