<?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: Python select_analysis where clause for numeric field in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110665#M8608</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You got it to work in modelbuilder as you indicate. &amp;nbsp;Could you export the model to a python script and report the syntax from the script? Don't run the script, just produce the format. &amp;nbsp;Perhaps there is a difference in the translation from model to script that doesn't work, or at least you will have the correct syntax to use from a standalone script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Oct 2016 22:43:26 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2016-10-20T22:43:26Z</dc:date>
    <item>
      <title>Python select_analysis where clause for numeric field</title>
      <link>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110658#M8601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I get error "Invalid expression" for:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;where_clause ='"Yr" IS NULL' &lt;BR /&gt;arcpy.Select_analysis(InFC, OutFC, where_clause)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the correct syntax?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2016 22:52:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110658#M8601</guid>
      <dc:creator>PitersonPaulgek</dc:creator>
      <dc:date>2016-10-18T22:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: Python select_analysis where clause for numeric field</title>
      <link>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110659#M8602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;'Yr IS NULL'. Otherwise, verify your expression in the tool GUI, and consult:&amp;nbsp;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/map/working-with-layers/building-a-query-expression.htm#GUID-A12F259C-E52D-451E-BB32-77EF5DBD6008" title="http://desktop.arcgis.com/en/arcmap/latest/map/working-with-layers/building-a-query-expression.htm#GUID-A12F259C-E52D-451E-BB32-77EF5DBD6008"&gt;Building a query expression—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;edit: it's also good practice to use &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/addfielddelimiters.htm"&gt;AddFieldDelimiters&lt;/A&gt; to ensure&amp;nbsp;correct field delimiters (brackets, quotes, or none).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;edit 2: once you get something to work through the GUI, you can right-click in the results window and copy as Python snippet to see the syntax. It looks like ArcGIS will accept this syntax:&amp;nbsp;where_clause=""""YR" IS NULL""" (four double-quotes at the beginning, three at the end)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2016 23:09:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110659#M8602</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2016-10-18T23:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: Python select_analysis where clause for numeric field</title>
      <link>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110660#M8603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Darren,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried: the same error:&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;Invalid expression.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I definitely got working with ModelBuilder first, then exported to Python.&lt;/P&gt;&lt;P&gt;So,&lt;/P&gt;&lt;P&gt;In GUI (ModelBuilder) (with SQL Query Builder wizard):&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;Yr IS NOT NULL (it works in ModelBuilder without any quotes)&lt;/P&gt;&lt;P&gt;in Python (*.py):&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;I tried:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="background-color: #ffffff;"&gt;1) where_clause ='Yr IS NULL' - ERROR&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="background-color: #ffffff;"&gt;2)&amp;nbsp;&lt;SPAN&gt;where_clause ='"Yr" IS NULL'&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;- ERROR&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;3)&amp;nbsp;&lt;SPAN&gt;where_clause =""""Yr" IS NULL"""&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;- ERROR&lt;/SPAN&gt;&lt;BR style="background-color: #ffffff;" /&gt;&lt;SPAN style="background-color: #ffffff;"&gt;arcpy.Select_analysis(InFC, OutFC, where_clause)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;For another field (text) it works fine in Python&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;arcpy.Select_analysis(InFC, OutFC, "Prime = 'Iron Ore'")&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;I've noticed that I work with layer(not feature class). I do MakeFeatureLayer that is the input for Select. Could it have an impact?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2016 04:28:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110660#M8603</guid>
      <dc:creator>PitersonPaulgek</dc:creator>
      <dc:date>2016-10-19T04:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: Python select_analysis where clause for numeric field</title>
      <link>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110661#M8604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do a Select By Attributes on the table in ArcMap, then copy that SQL syntax to your Python code.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2016 14:02:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110661#M8604</guid>
      <dc:creator>MitchHolley1</dc:creator>
      <dc:date>2016-10-19T14:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: Python select_analysis where clause for numeric field</title>
      <link>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110662#M8605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the datasource for the feature layer (FGDB feature class, PGDB feature class, shapefile, other) and what is the datatype of the field YR?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2016 16:36:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110662#M8605</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2016-10-19T16:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: Python select_analysis where clause for numeric field</title>
      <link>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110663#M8606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Datasource for the feature layer -&amp;nbsp;&lt;SPAN&gt;FGDB feature class.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;Datatype of the field YR - Long Integer&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;(D&lt;SPAN style="background-color: #ffffff;"&gt;atatype of the field &lt;SPAN&gt;Prime - Text (it work fine - see comments above))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Oct 2016 22:15:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110663#M8606</guid>
      <dc:creator>PitersonPaulgek</dc:creator>
      <dc:date>2016-10-20T22:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Python select_analysis where clause for numeric field</title>
      <link>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110664#M8607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Mitch,&lt;/P&gt;&lt;P&gt;I did - it works fine in ArcMap &lt;SPAN style="background-color: #ffffff;"&gt;Select By Attributes (SQL wizard)&lt;/SPAN&gt;. The syntax is:&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;Yr IS NOT NULL&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;No quotes!&lt;/P&gt;&lt;P&gt;Any ideas, please!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Oct 2016 22:38:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110664#M8607</guid>
      <dc:creator>PitersonPaulgek</dc:creator>
      <dc:date>2016-10-20T22:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: Python select_analysis where clause for numeric field</title>
      <link>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110665#M8608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You got it to work in modelbuilder as you indicate. &amp;nbsp;Could you export the model to a python script and report the syntax from the script? Don't run the script, just produce the format. &amp;nbsp;Perhaps there is a difference in the translation from model to script that doesn't work, or at least you will have the correct syntax to use from a standalone script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Oct 2016 22:43:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110665#M8608</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-10-20T22:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: Python select_analysis where clause for numeric field</title>
      <link>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110666#M8609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan,&lt;/P&gt;&lt;P&gt;I did the export. The syntax from the exported:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;# Process: Select (2)&lt;BR /&gt;arcpy.Select_analysis(***, ***, "Yr IS NOT NULL")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, what is the correct? Please help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Oct 2016 22:50:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110666#M8609</guid>
      <dc:creator>PitersonPaulgek</dc:creator>
      <dc:date>2016-10-20T22:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: Python select_analysis where clause for numeric field</title>
      <link>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110667#M8610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Piterson, from what is given, then it appears field delimiters are not needed, which seems to be consistent with the suggestions in ArcGIS Pro ... now I am assuming that you hide your layer and field names to preserve anonymity given the syntax ....&amp;nbsp;Select_analysis (in_features, out_feature_class, {where_clause}) ...&lt;/P&gt;&lt;P&gt;since ***, and *** are not obviously going to work in a python script. &amp;nbsp;You could try a simple script to test. by replacing the in_features and out_feature_class with the path to a file (shapefile or featurelayer in a gdb) for source and destination.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Oct 2016 23:01:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110667#M8610</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-10-20T23:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Python select_analysis where clause for numeric field</title>
      <link>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110668#M8611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Fortunatelly, I run the simple test (Delete and Select) - it worked in ModelBuilder and then exported to PythonScript with syntax :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; line-height: 25.9500007629395px; background-color: #ffffff;"&gt;arcpy.Select_analysis(in_features,out_features&lt;/SPAN&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; line-height: 25.9500007629395px; background-color: #ffffff;"&gt;, "Yr IS NOT NULL")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; line-height: 25.9500007629395px; background-color: #ffffff;"&gt; Thanks for help!!!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Oct 2016 11:46:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-select-analysis-where-clause-for-numeric/m-p/110668#M8611</guid>
      <dc:creator>PitersonPaulgek</dc:creator>
      <dc:date>2016-10-24T11:46:34Z</dc:date>
    </item>
  </channel>
</rss>

