<?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: Is there a way to make a SearchCursor ignore a selection? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/is-there-a-way-to-make-a-searchcursor-ignore-a/m-p/638168#M49742</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Joshua gets the star; particularly as he has introduced a new concept to me, these &lt;EM&gt;lambda&lt;/EM&gt; functions. Never used these and had to go search the internet to find out what they were! &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt; Came across &lt;A href="https://pythonconquerstheuniverse.wordpress.com/2011/08/29/lambda_tutorial/"&gt;this&lt;/A&gt; website that explains what and why you would use them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to admit I thought about accessing the table as a Table object rather than a TableView but thought it would be best to check with the community if there was some other whizzy way of doing it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the advice&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Aug 2015 14:13:14 GMT</pubDate>
    <dc:creator>DuncanHornby</dc:creator>
    <dc:date>2015-08-27T14:13:14Z</dc:date>
    <item>
      <title>Is there a way to make a SearchCursor ignore a selection?</title>
      <link>https://community.esri.com/t5/python-questions/is-there-a-way-to-make-a-searchcursor-ignore-a/m-p/638164#M49738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Arcpy Guru's,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you use a TableView with a selection as the table in a SearchCursor, the cursor honours the existing selection. I was wondering is there a property or way of making a cursor simply ignore any existing selection?&amp;nbsp; Why would I want this? Well I want to summarize a field in the whole table but the table had a selection (which is important), I do not want to clear the selection as I use the selection in some later processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example in ArcMap when you use the GUI tool Select By Location you have a check box that allows you to use or not use the selected features. I could not find a property or parameter of the cursor to say "ignore the selection, process all records, but don't clear the selection"?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Duncan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 11:29:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-there-a-way-to-make-a-searchcursor-ignore-a/m-p/638164#M49738</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2015-08-27T11:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to make a SearchCursor ignore a selection?</title>
      <link>https://community.esri.com/t5/python-questions/is-there-a-way-to-make-a-searchcursor-ignore-a/m-p/638165#M49739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try using&amp;nbsp; the source lyr.dataSource for your search cursor that should bypass the selection.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 12:46:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-there-a-way-to-make-a-searchcursor-ignore-a/m-p/638165#M49739</guid>
      <dc:creator>WesMiller</dc:creator>
      <dc:date>2015-08-27T12:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to make a SearchCursor ignore a selection?</title>
      <link>https://community.esri.com/t5/python-questions/is-there-a-way-to-make-a-searchcursor-ignore-a/m-p/638166#M49740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the &lt;SPAN style="font-family: courier new,courier;"&gt;catalogPath&lt;/SPAN&gt; property of an ArcPy &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-functions/describe.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Describe &lt;/A&gt;object instead of the &lt;SPAN style="font-family: courier new,courier;"&gt;dataSource&lt;/SPAN&gt; property of an ArcPy Mapping &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-mapping/layer-class.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Layer &lt;/A&gt;object.&amp;nbsp; I prefer this approach because often times I am working with layer names as strings instead of layers as layer objects.&amp;nbsp; Also, using the ArcPy Describe function works if you are in a standalone script that doesn't involve a map document.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Depending on the circumstances, I either write a normal function or a lambda function to get the catalog path, and then call the function and pass the layer name in the search cursor:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;dataSource = lambda in_layer: arcpy.Describe(in_layer).catalogPath
with arcpy.da.SearchCursor(dataSource(layer_name), fields) as cur:
&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:08:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-there-a-way-to-make-a-searchcursor-ignore-a/m-p/638166#M49740</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-12T03:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to make a SearchCursor ignore a selection?</title>
      <link>https://community.esri.com/t5/python-questions/is-there-a-way-to-make-a-searchcursor-ignore-a/m-p/638167#M49741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Duncan as Wes and Joshua have indicated, simply read it from disk to get all and from the layer to get the selection.&amp;nbsp; However, you could fudge that by reading the selection, switch the selection (in code) and getting the results, so you would have the part and the sum of the parts&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 13:41:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-there-a-way-to-make-a-searchcursor-ignore-a/m-p/638167#M49741</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-08-27T13:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to make a SearchCursor ignore a selection?</title>
      <link>https://community.esri.com/t5/python-questions/is-there-a-way-to-make-a-searchcursor-ignore-a/m-p/638168#M49742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Joshua gets the star; particularly as he has introduced a new concept to me, these &lt;EM&gt;lambda&lt;/EM&gt; functions. Never used these and had to go search the internet to find out what they were! &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt; Came across &lt;A href="https://pythonconquerstheuniverse.wordpress.com/2011/08/29/lambda_tutorial/"&gt;this&lt;/A&gt; website that explains what and why you would use them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to admit I thought about accessing the table as a Table object rather than a TableView but thought it would be best to check with the community if there was some other whizzy way of doing it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the advice&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 14:13:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-there-a-way-to-make-a-searchcursor-ignore-a/m-p/638168#M49742</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2015-08-27T14:13:14Z</dc:date>
    </item>
  </channel>
</rss>

