<?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: Unable to set a where clause using &amp;lt;&amp;gt; '   ' in a Python 3.x script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/unable-to-set-a-where-clause-using-lt-gt-in-a/m-p/359147#M28352</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very weird!&amp;nbsp; Glad you were able to overcome it none the less.&amp;nbsp; Excel always seems to bring new and exciting challenges when working with them in ArcGIS.&amp;nbsp; &amp;nbsp;&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 Sep 2020 14:23:54 GMT</pubDate>
    <dc:creator>JoeBorgione</dc:creator>
    <dc:date>2020-09-16T14:23:54Z</dc:date>
    <item>
      <title>Unable to set a where clause using &lt;&gt; '   ' in a Python 3.x script</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-set-a-where-clause-using-lt-gt-in-a/m-p/359142#M28347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Totally stumped.&amp;nbsp;I have&amp;nbsp;a few records in a table that I imported into a file geodatabase from Excel that have three blank spaces in a text field called Specialty_Code instead of the required three character code. I want my script to skip those records in the analysis, so I'm creating a table view that excludes those records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using Python 3.x, why does this work (line 3)....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;    allRecords &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; defaultGDB &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'\\CleanTable_'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; fileName
    outLayer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'CleanTable_'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; fileName &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'_View'&lt;/SPAN&gt;
    defQuery &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Specialty_Code IS NOT NULL"&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;defQuery&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    readyToAppend &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeTableView_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;allRecords&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; outLayer&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; defQuery&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;... but this doesn't (line 3)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;    allRecords &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; defaultGDB &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'\\CleanTable_'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; fileName
    outLayer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'CleanTable_'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; fileName &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'_View'&lt;/SPAN&gt;
    defQuery &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Specialty_Code IS NOT NULL and Specialty_Code &amp;lt;&amp;gt; \'   \'"&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;defQuery&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    readyToAppend &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeTableView_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;allRecords&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; outLayer&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; defQuery&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error message is&amp;nbsp;arcgisscripting.ExecuteError: ERROR 000358: Invalid expression&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:46:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-set-a-where-clause-using-lt-gt-in-a/m-p/359142#M28347</guid>
      <dc:creator>AmyRoust</dc:creator>
      <dc:date>2021-12-11T16:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to set a where clause using &lt;&gt; '   ' in a Python 3.x script</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-set-a-where-clause-using-lt-gt-in-a/m-p/359143#M28348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does this work?&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;defQuery &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Specialty_Code IS NOT NULL and Specialty_Code &amp;lt;&amp;gt; '   ' "&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2020 21:16:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-set-a-where-clause-using-lt-gt-in-a/m-p/359143#M28348</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-09-15T21:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to set a where clause using &lt;&gt; '   ' in a Python 3.x script</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-set-a-where-clause-using-lt-gt-in-a/m-p/359144#M28349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, that didn't work either. After further digging, the problem became more complicated. Despite the fact that there are records with 3 spaces in them, that column imported from Excel into&amp;nbsp;my FGDB as a double by default (most of the records are three-digit numbers, many with leading zeros). That would explain why a text-based query failed to work -- it wasn't a text field. I ended up querying out those records earlier in the script, before they&amp;nbsp;imported into the FGDB. Problem solved, but it does leave me wondering if there is any programmatic solution to remove blank spaces that are in a double field. I tried the steps in Model Builder (using the text string that failed in my script) and they worked fine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Sep 2020 13:01:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-set-a-where-clause-using-lt-gt-in-a/m-p/359144#M28349</guid>
      <dc:creator>AmyRoust</dc:creator>
      <dc:date>2020-09-16T13:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to set a where clause using &lt;&gt; '   ' in a Python 3.x script</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-set-a-where-clause-using-lt-gt-in-a/m-p/359145#M28350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;An after the fact qestion; if the field is a double, how did it have three spaces and not a &amp;lt;Null&amp;gt; value?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Sep 2020 13:28:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-set-a-where-clause-using-lt-gt-in-a/m-p/359145#M28350</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-09-16T13:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to set a where clause using &lt;&gt; '   ' in a Python 3.x script</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-set-a-where-clause-using-lt-gt-in-a/m-p/359146#M28351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is an excellent question, Joe, and one for which I do not have an answer. Definitely falls into the "that shouldn't happen, but it did anyway" category.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Sep 2020 14:11:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-set-a-where-clause-using-lt-gt-in-a/m-p/359146#M28351</guid>
      <dc:creator>AmyRoust</dc:creator>
      <dc:date>2020-09-16T14:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to set a where clause using &lt;&gt; '   ' in a Python 3.x script</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-set-a-where-clause-using-lt-gt-in-a/m-p/359147#M28352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very weird!&amp;nbsp; Glad you were able to overcome it none the less.&amp;nbsp; Excel always seems to bring new and exciting challenges when working with them in ArcGIS.&amp;nbsp; &amp;nbsp;&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Sep 2020 14:23:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-set-a-where-clause-using-lt-gt-in-a/m-p/359147#M28352</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-09-16T14:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to set a where clause using &lt;&gt; '   ' in a Python 3.x script</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-set-a-where-clause-using-lt-gt-in-a/m-p/359148#M28353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is impossible to have text in a numeric data field in ArcGIS.&amp;nbsp; When you say, "imported from Excel into&amp;nbsp;my FGDB as a double by default ," did you actually confirm the field is double?&amp;nbsp; If the field is in fact numeric, then you don't have spaces in it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Sep 2020 14:27:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-set-a-where-clause-using-lt-gt-in-a/m-p/359148#M28353</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-09-16T14:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to set a where clause using &lt;&gt; '   ' in a Python 3.x script</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-set-a-where-clause-using-lt-gt-in-a/m-p/359149#M28354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I did confirm that it came in as a double. I wouldn't have believed it if I hadn't seen it with my own eyes because you are 100% right that it's impossible. I wish I still had the table so that I could screenshot it and post, but it would take more time than I'm willing to spend to undo the corrections I've written into the script to recreate the issue.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Sep 2020 14:54:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-set-a-where-clause-using-lt-gt-in-a/m-p/359149#M28354</guid>
      <dc:creator>AmyRoust</dc:creator>
      <dc:date>2020-09-16T14:54:04Z</dc:date>
    </item>
  </channel>
</rss>

