<?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: arcpy.da.searchcursor with expression in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-da-searchcursor-with-expression/m-p/415548#M32716</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There is a bug that is fixed at 10.2-&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;NIM076948- The arcpy.da.SearchCursor() where clause does not work with a table view.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 May 2013 21:44:04 GMT</pubDate>
    <dc:creator>LucasDanzinger</dc:creator>
    <dc:date>2013-05-13T21:44:04Z</dc:date>
    <item>
      <title>arcpy.da.searchcursor with expression</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-da-searchcursor-with-expression/m-p/415545#M32713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just wondering if anyone has had any trouble with using a query expression with arcpy.da.searchcursor?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've used this successfully many time but I have code where I create table views from tables in a fGDB then use a cursor on selected records using arcpy.da.searchcursor.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One of these works fine while the other does not reduce the number of records from the total records in the table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've stared at this for a while and really don't see a reason why one would work and the other does not. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The only think I can think of is that the table view that does NOT work has a joined table associated with it using AddJoin.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Otherwise there is no significant difference that I can see between the two.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One other thing I did try was to using CopyRows to copy the table view to a table, use MakeTableView using the same query expression used above in the arcpy.da.searchcursor, and then use CopyRows to a copy the view to table.&amp;nbsp; After this runs, the final table copied behaves as if the query was not applied (same as happens in arcpy.da.searchcursor).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;any leads appreciated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 May 2013 19:04:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-da-searchcursor-with-expression/m-p/415545#M32713</guid>
      <dc:creator>BKS</dc:creator>
      <dc:date>2013-05-13T19:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.da.searchcursor with expression</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-da-searchcursor-with-expression/m-p/415546#M32714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The field names will change when you use the 'AddJoin' tool, and this is most likely the issue.&amp;nbsp; The new field name will be &lt;/SPAN&gt;&lt;STRONG&gt;&amp;lt;feature class/table name&amp;gt;.&amp;lt;field name&amp;gt;&lt;/STRONG&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 May 2013 19:07:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-da-searchcursor-with-expression/m-p/415546#M32714</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2013-05-13T19:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.da.searchcursor with expression</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-da-searchcursor-with-expression/m-p/415547#M32715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The field names will change when you use the 'AddJoin' tool, and this is most likely the issue.&amp;nbsp; The new field name will be &lt;STRONG&gt;&amp;lt;feature class/table name&amp;gt;.&amp;lt;field name&amp;gt;&lt;/STRONG&gt;.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wish that was the problem but already handle that.&amp;nbsp; I print the expression and try the same expression on the table manually and it works just fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Technically I use CopyRows to copy the table view (that includes the join) to a table in the fGDB.&amp;nbsp; Then I copy the expression used from the code and it works.&amp;nbsp; The one think I needed to do was change the "." character to a "_" character since this is what happens when you save a table with a join to a fGDB.&amp;nbsp; I assume the fGDB doesn't like "." in field names so it converts to "_".&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 May 2013 19:12:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-da-searchcursor-with-expression/m-p/415547#M32715</guid>
      <dc:creator>BKS</dc:creator>
      <dc:date>2013-05-13T19:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.da.searchcursor with expression</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-da-searchcursor-with-expression/m-p/415548#M32716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There is a bug that is fixed at 10.2-&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;NIM076948- The arcpy.da.SearchCursor() where clause does not work with a table view.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 May 2013 21:44:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-da-searchcursor-with-expression/m-p/415548#M32716</guid>
      <dc:creator>LucasDanzinger</dc:creator>
      <dc:date>2013-05-13T21:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.da.searchcursor with expression</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-da-searchcursor-with-expression/m-p/415549#M32717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks - I couldn't think of anything else to try.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What's strange is that it does work sometimes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't know how to see the contents of the bug so can you tell me if the arcpy.searchcursor works on a table view with a where clause (i.e. is this limited to arcpy.da.searchcursor)?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 00:40:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-da-searchcursor-with-expression/m-p/415549#M32717</guid>
      <dc:creator>BKS</dc:creator>
      <dc:date>2013-05-14T00:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.da.searchcursor with expression</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-da-searchcursor-with-expression/m-p/415550#M32718</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;There is a bug that is fixed at 10.2-&lt;BR /&gt;&lt;BR /&gt;NIM076948- The arcpy.da.SearchCursor() where clause does not work with a table view.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;NOTE:&amp;nbsp; As a work-around I successfully copied the table view to an in_memory table using CopyRows.&amp;nbsp; This solved the problem since arcpy.da.searchcursor with where clause works if the source is a table as far as I understand the bug.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Brian&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 13:46:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-da-searchcursor-with-expression/m-p/415550#M32718</guid>
      <dc:creator>BKS</dc:creator>
      <dc:date>2013-05-14T13:46:22Z</dc:date>
    </item>
  </channel>
</rss>

