<?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 SelectLayerByAttribute_management with a domain in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-selectlayerbyattribute-management-with-a/m-p/368778#M29070</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep. 'Love&amp;nbsp;me a good ol' over-thinking session.&amp;nbsp; Then when it's over, simple wins!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Apr 2020 21:28:03 GMT</pubDate>
    <dc:creator>JoeBorgione</dc:creator>
    <dc:date>2020-04-30T21:28:03Z</dc:date>
    <item>
      <title>ArcPy SelectLayerByAttribute_management with a domain</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-selectlayerbyattribute-management-with-a/m-p/368772#M29064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to subset my database and when I tried&amp;nbsp;&lt;/P&gt;&lt;P&gt;arcpy.SelectLayerByAttribute_management ("OHlyr3", "NEW_SELECTION", " [SUBTYPECD]" LIKE \'%Overhead\' )&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was getting an error on the sql expression. Than I found out the field "&lt;SPAN&gt;SUBTYPECD" is really a domain.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What I need is to query against part of it's value like Overhead where I have "Single Phase Overhead" as a domain value&amp;nbsp; It's coded number is 2 if that's easy.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2020 19:03:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-selectlayerbyattribute-management-with-a/m-p/368772#M29064</guid>
      <dc:creator>BillChappell</dc:creator>
      <dc:date>2020-04-30T19:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy SelectLayerByAttribute_management with a domain</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-selectlayerbyattribute-management-with-a/m-p/368773#M29065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN style="background-color: #ffffff;"&gt;I found out the field "&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; border: 0px;"&gt;SUBTYPECD" is really a domain.&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; border: 0px;"&gt;The field isn't a domain, it's a field that is controlled by a domain.&amp;nbsp; What happens if you write your query like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;select = 'SUBTYPECD = 2'

arcpy.SelectLayerByAttribute_management ("OHlyr3", "NEW_SELECTION", select) &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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:05:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-selectlayerbyattribute-management-with-a/m-p/368773#M29065</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-12-11T17:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy SelectLayerByAttribute_management with a domain</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-selectlayerbyattribute-management-with-a/m-p/368774#M29066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What an interesting question, I was trying to wrap my head around that!&lt;/P&gt;&lt;P&gt;Can you just work out which domains contain 'Overhead'?&lt;/P&gt;&lt;P&gt;eg if overhead appears in coded value 2,4,9 and 10:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #3d3d3d; font-family: inherit; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt; "[SUBTYPECD]" IN (2, 4 ,9, 10)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #3d3d3d; font-family: inherit; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;I also believe the query should be passed as a string in itself, ie:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #3d3d3d; font-family: inherit; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;query = '&amp;nbsp;"[SUBTYPECD]" IN (2, 4 ,9, 10) '&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #3d3d3d; font-family: inherit; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;arcpy.SelectLayerByAttribute_management ("OHlyr3", "NEW_SELECTION", query )&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #3d3d3d; font-family: inherit; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;hope this helps&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2020 20:00:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-selectlayerbyattribute-management-with-a/m-p/368774#M29066</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-04-30T20:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy SelectLayerByAttribute_management with a domain</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-selectlayerbyattribute-management-with-a/m-p/368775#M29067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I started typing before you replied Joe, honest!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2020 20:02:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-selectlayerbyattribute-management-with-a/m-p/368775#M29067</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-04-30T20:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy SelectLayerByAttribute_management with a domain</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-selectlayerbyattribute-management-with-a/m-p/368776#M29068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The beauty of this forum!&amp;nbsp;&amp;nbsp;&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/laugh.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2020 20:06:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-selectlayerbyattribute-management-with-a/m-p/368776#M29068</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-04-30T20:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy SelectLayerByAttribute_management with a domain</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-selectlayerbyattribute-management-with-a/m-p/368777#M29069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This works, it's the simple solution that I overlooked. Instead I tried 20 different ways screwing around with the quotes and backslashes that just confused me. Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2020 21:19:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-selectlayerbyattribute-management-with-a/m-p/368777#M29069</guid>
      <dc:creator>BillChappell</dc:creator>
      <dc:date>2020-04-30T21:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy SelectLayerByAttribute_management with a domain</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-selectlayerbyattribute-management-with-a/m-p/368778#M29070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep. 'Love&amp;nbsp;me a good ol' over-thinking session.&amp;nbsp; Then when it's over, simple wins!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2020 21:28:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-selectlayerbyattribute-management-with-a/m-p/368778#M29070</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-04-30T21:28:03Z</dc:date>
    </item>
  </channel>
</rss>

