<?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: Select tool ArcPy SQL expression in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/select-tool-arcpy-sql-expression/m-p/1334316#M44728</link>
    <description>&lt;P&gt;Best practice is to use &lt;FONT face="courier new,courier"&gt;str.format()&lt;/FONT&gt; (or&lt;FONT face="courier new,courier"&gt; f""&lt;/FONT&gt;) to layout your expression (and avoid error-prone string math). If you're having difficulty, you should always &lt;FONT face="courier new,courier"&gt;print&lt;/FONT&gt; the resulting parameters. And test the resulting statement from the UI. Without seeing the contents of the table or the resulting expression, there isn't much we can do to help.&lt;/P&gt;&lt;P&gt;- V&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 02 Oct 2023 21:05:13 GMT</pubDate>
    <dc:creator>VinceAngelo</dc:creator>
    <dc:date>2023-10-02T21:05:13Z</dc:date>
    <item>
      <title>Select tool ArcPy SQL expression</title>
      <link>https://community.esri.com/t5/data-management-questions/select-tool-arcpy-sql-expression/m-p/1334256#M44727</link>
      <description>&lt;P&gt;I am trying to write a script using the select tool to select only those rows with the field description "Seaplane Base". I can get the other value, "Airport" to work, but when I run the script, it gives me an &lt;STRONG&gt;empty table&lt;/STRONG&gt; in the new file when selecting "Seaplane Base".&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
arcpy.env.workspace = "###"
infc = "airports.shp"
outfc = "airports_sea.shp"
delim_field = arcpy.AddFieldDelimiters(infc, "FEATURE")
sql_exp = delim_field + " = 'Seaplane Base'"
arcpy.Select_analysis(infc, outfc, sql_exp)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Please help&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 18:57:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/select-tool-arcpy-sql-expression/m-p/1334256#M44727</guid>
      <dc:creator>BergstromGIS</dc:creator>
      <dc:date>2023-10-02T18:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: Select tool ArcPy SQL expression</title>
      <link>https://community.esri.com/t5/data-management-questions/select-tool-arcpy-sql-expression/m-p/1334316#M44728</link>
      <description>&lt;P&gt;Best practice is to use &lt;FONT face="courier new,courier"&gt;str.format()&lt;/FONT&gt; (or&lt;FONT face="courier new,courier"&gt; f""&lt;/FONT&gt;) to layout your expression (and avoid error-prone string math). If you're having difficulty, you should always &lt;FONT face="courier new,courier"&gt;print&lt;/FONT&gt; the resulting parameters. And test the resulting statement from the UI. Without seeing the contents of the table or the resulting expression, there isn't much we can do to help.&lt;/P&gt;&lt;P&gt;- V&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 21:05:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/select-tool-arcpy-sql-expression/m-p/1334316#M44728</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2023-10-02T21:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: Select tool ArcPy SQL expression</title>
      <link>https://community.esri.com/t5/data-management-questions/select-tool-arcpy-sql-expression/m-p/1334513#M44729</link>
      <description>&lt;P&gt;Agree with &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1060"&gt;@VinceAngelo&lt;/a&gt;, I've been burnt many times by not testing my expressions in the application first and realizing I've made a mistake in my expression or pointed the tool at the wrong dataset. For reference, using a f"" to set your expression would look like the following:&lt;/P&gt;&lt;P&gt;sql_exp = f"{delim_field} = 'Seaplane Base'"&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 13:39:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/select-tool-arcpy-sql-expression/m-p/1334513#M44729</guid>
      <dc:creator>RobertKrisher</dc:creator>
      <dc:date>2023-10-03T13:39:14Z</dc:date>
    </item>
  </channel>
</rss>

