<?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: SearchCursor where clause in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/searchcursor-where-clause/m-p/325694#M25336</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;my previous code was before;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
arcpy.SelectLayerByLocation_management(CCP, "WITHIN_A_DISTANCE", SP2, "1 MILE", "NEW_SELECTION")
if int(arcpy.GetCount_management("CURRENT_CUPS").getOutput(0)) &amp;gt; 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management("CURRENT_CUPS", "CUPS")
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i need to selected layer by location&amp;nbsp; which is i did here &lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; arcpy.SelectLayerByLocation_management(CCP, "WITHIN_A_DISTANCE", SP2, "1 MILE", "NEW_SELECTION")
if int(arcpy.GetCount_management("CURRENT_CUPS").getOutput(0)) &amp;gt; 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management("CURRENT_CUPS", "CUPS") &lt;/PRE&gt;&lt;SPAN&gt; but then i need to select from that selection all the features that are 2009 and up from the "Years" field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 15:26:37 GMT</pubDate>
    <dc:creator>TonyAlmeida</dc:creator>
    <dc:date>2021-12-11T15:26:37Z</dc:date>
    <item>
      <title>SearchCursor where clause</title>
      <link>https://community.esri.com/t5/python-questions/searchcursor-where-clause/m-p/325690#M25332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I a script that selections by location, but after that i need it to search the selected in the "Year" field anything &amp;gt;= to 2009, then copy those features out. Any help would be very appreciated. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Her is what i currently have but i am getting an error of nameerror: name 'rows is not defined.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.SelectLayerByLocation_management(CCP, "WITHIN_A_DISTANCE", SP2, "1 MILE", "NEW_SELECTION")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if int(arcpy.GetCount_management("CURRENT_CUPS").getOutput(0)) &amp;gt; 0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.arcpy.SearchCursor(CCP, "YEAR &amp;gt;=2009", "", "YEAR", "YEAR A")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management("CURRENT_CUPS", "CUPS")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Mar 2013 15:51:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/searchcursor-where-clause/m-p/325690#M25332</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2013-03-19T15:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor where clause</title>
      <link>https://community.esri.com/t5/python-questions/searchcursor-where-clause/m-p/325691#M25333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Are you wanting to copy every feature selected as its own feature class?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Mar 2013 16:59:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/searchcursor-where-clause/m-p/325691#M25333</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2013-03-19T16:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor where clause</title>
      <link>https://community.esri.com/t5/python-questions/searchcursor-where-clause/m-p/325692#M25334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;No just into one, into "CUPS".&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Mar 2013 18:31:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/searchcursor-where-clause/m-p/325692#M25334</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2013-03-19T18:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor where clause</title>
      <link>https://community.esri.com/t5/python-questions/searchcursor-where-clause/m-p/325693#M25335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Then you don't need to bother with a cursor at all.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.SelectLayerByLocation_management(CCP, "WITHIN_A_DISTANCE", SP2, "1 MILE", "NEW_SELECTION")
if int(arcpy.GetCount_management(CCP).getOutput(0)) &amp;gt; 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(CCP, "CUPS")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:26:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/searchcursor-where-clause/m-p/325693#M25335</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-11T15:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor where clause</title>
      <link>https://community.esri.com/t5/python-questions/searchcursor-where-clause/m-p/325694#M25336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;my previous code was before;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
arcpy.SelectLayerByLocation_management(CCP, "WITHIN_A_DISTANCE", SP2, "1 MILE", "NEW_SELECTION")
if int(arcpy.GetCount_management("CURRENT_CUPS").getOutput(0)) &amp;gt; 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management("CURRENT_CUPS", "CUPS")
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i need to selected layer by location&amp;nbsp; which is i did here &lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; arcpy.SelectLayerByLocation_management(CCP, "WITHIN_A_DISTANCE", SP2, "1 MILE", "NEW_SELECTION")
if int(arcpy.GetCount_management("CURRENT_CUPS").getOutput(0)) &amp;gt; 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management("CURRENT_CUPS", "CUPS") &lt;/PRE&gt;&lt;SPAN&gt; but then i need to select from that selection all the features that are 2009 and up from the "Years" field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:26:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/searchcursor-where-clause/m-p/325694#M25336</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2021-12-11T15:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor where clause</title>
      <link>https://community.esri.com/t5/python-questions/searchcursor-where-clause/m-p/325695#M25337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can just use feature class to feature class with an expression.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;arcpy.SelectLayerByLocation_management(CCP, "WITHIN_A_DISTANCE", SP2, "1 MILE", "NEW_SELECTION") if int(arcpy.GetCount_management(CCP).getOutput(0)) &amp;gt; 0: &amp;nbsp;&amp;nbsp;&amp;nbsp; expression = "YEAR &amp;gt;=2009" &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.FeatureClassToFeatureClass_conversion(CCP, out_workspace, "CUPS", expression)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Mar 2013 20:43:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/searchcursor-where-clause/m-p/325695#M25337</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2013-03-19T20:43:03Z</dc:date>
    </item>
  </channel>
</rss>

