I've read through most of the other similar questions and nothing so far has addressed my issue; most are about syntax.
I'm trying to select by attribute from a Feature Layer. But every time, Arc announces that it succeeded and nothing is selected. It works just fine using the same expression to select from a Table View. Any ideas?
expression <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>AddFieldDelimiters<SPAN class="punctuation token">(</SPAN>tempFeatureLayer<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"BLDG_ID"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="string token">" LIKE '{0}%'"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>county<SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>SelectLayerByAttribute_management<SPAN class="punctuation token">(</SPAN>tempFeatureLayer<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"NEW_SELECTION"</SPAN><SPAN class="punctuation token">,</SPAN> expression<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">if</SPAN> int<SPAN class="punctuation token">(</SPAN>arcpy<SPAN class="punctuation token">.</SPAN>GetCount_management<SPAN class="punctuation token">(</SPAN>tempFeatureLayer<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">></SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">:</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>DeleteRows_management<SPAN class="punctuation token">(</SPAN>tempFeatureLayer<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>It's an SDE Database feature class, if that makes a difference.
I've also tried rewriting the expression as below with the same result:
expression <SPAN class="operator token">=</SPAN> <SPAN class="string token">""" "BLDG_ID" LIKE '37019%'"""</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
and
expression <SPAN class="operator token">=</SPAN> <SPAN class="string token">"BLDG_ID LIKE '37019%'"</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>