<?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 How to select&amp;#160; a line with specific numeric field value using an inline&amp;#160; variable for UpdateCursor in ArcGIS 10.0 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-select-160-a-line-with-specific-numeric/m-p/378864#M29893</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm currently away in a remote field station using Arc 10.0 and having a hard time using an inline variable substitution for a numeric field value. I am trying to use UpdateCursor to select only a specific line by designating a "POSITION" field = to a numeric value that I can increment each time I go through the for loop.&amp;nbsp;&amp;nbsp; When I use a number in the line, it works. However, I can't seem to get the right syntax to substitute the hard-coded number for a variable.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here's the section of code:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;## Attempt to update the cursor, then get value, then setvalue using an inline variable for the desired Field value&lt;/P&gt;&lt;P&gt;## THIS does not work&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;stefile = "ste1.shp"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;stefield = "POSITION"&lt;/P&gt;&lt;P&gt;steclus = "CLUSTER"&lt;/P&gt;&lt;P&gt;steac = "AC"&lt;/P&gt;&lt;P&gt;stevalue = 100&lt;/P&gt;&lt;P&gt;stepos = 22&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Z = arcpy.UpdateCursor(stefile, '"POSITION" = stepos')&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # This needs to be changed eg; '"POSITION" = a memvar') ...and at end of loop memvar +=1&lt;/P&gt;&lt;P&gt;for row in Z:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print row.getValue(steclus)&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; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; memvar = row.getValue(steclus)&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; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(steac, stevalue)&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; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Z.updateRow(row)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print row.getValue(steac)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; del Z&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; del row&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;### HERE are the error messages&lt;/P&gt;&lt;P&gt;# Runtime error &amp;lt;type 'exceptions.RuntimeError'&amp;gt;: ERROR 999999:&lt;/P&gt;&lt;P&gt;# Error executing function.&lt;/P&gt;&lt;P&gt;# A column was specified that does not exist.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am I simply using the wrong syntax? Or am I barking up the wrong tree?&lt;/P&gt;&lt;P&gt;Guidance and advice welcome. Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Nov 2014 15:42:31 GMT</pubDate>
    <dc:creator>StephenMorreale</dc:creator>
    <dc:date>2014-11-20T15:42:31Z</dc:date>
    <item>
      <title>How to select  a line with specific numeric field value using an inline  variable for UpdateCursor in ArcGIS 10.0</title>
      <link>https://community.esri.com/t5/python-questions/how-to-select-160-a-line-with-specific-numeric/m-p/378864#M29893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm currently away in a remote field station using Arc 10.0 and having a hard time using an inline variable substitution for a numeric field value. I am trying to use UpdateCursor to select only a specific line by designating a "POSITION" field = to a numeric value that I can increment each time I go through the for loop.&amp;nbsp;&amp;nbsp; When I use a number in the line, it works. However, I can't seem to get the right syntax to substitute the hard-coded number for a variable.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here's the section of code:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;## Attempt to update the cursor, then get value, then setvalue using an inline variable for the desired Field value&lt;/P&gt;&lt;P&gt;## THIS does not work&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;stefile = "ste1.shp"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;stefield = "POSITION"&lt;/P&gt;&lt;P&gt;steclus = "CLUSTER"&lt;/P&gt;&lt;P&gt;steac = "AC"&lt;/P&gt;&lt;P&gt;stevalue = 100&lt;/P&gt;&lt;P&gt;stepos = 22&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Z = arcpy.UpdateCursor(stefile, '"POSITION" = stepos')&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # This needs to be changed eg; '"POSITION" = a memvar') ...and at end of loop memvar +=1&lt;/P&gt;&lt;P&gt;for row in Z:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print row.getValue(steclus)&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; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; memvar = row.getValue(steclus)&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; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(steac, stevalue)&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; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Z.updateRow(row)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print row.getValue(steac)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; del Z&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; del row&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;### HERE are the error messages&lt;/P&gt;&lt;P&gt;# Runtime error &amp;lt;type 'exceptions.RuntimeError'&amp;gt;: ERROR 999999:&lt;/P&gt;&lt;P&gt;# Error executing function.&lt;/P&gt;&lt;P&gt;# A column was specified that does not exist.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am I simply using the wrong syntax? Or am I barking up the wrong tree?&lt;/P&gt;&lt;P&gt;Guidance and advice welcome. Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 15:42:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-select-160-a-line-with-specific-numeric/m-p/378864#M29893</guid>
      <dc:creator>StephenMorreale</dc:creator>
      <dc:date>2014-11-20T15:42:31Z</dc:date>
    </item>
  </channel>
</rss>

