<?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 by attribute LIKE another attribute value in ArcMap Questions</title>
    <link>https://community.esri.com/t5/arcmap-questions/select-by-attribute-like-another-attribute-value/m-p/441957#M985</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bit of a stumper actually, I might just add a new field and run a field calculator expression on it to return 0 or 1 or something like that. then select by attributes where the new field = 1.&lt;/P&gt;&lt;P&gt;#pre-logic python&lt;/P&gt;&lt;P&gt;def checker(PIN, PIN_TRACKING):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if PIN IN PIN_TRACKING.split(","):&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = '1'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;else:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;result = '0'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;return result&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#window&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #3d3d3d; font-family: Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; 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;checker(!PIN!, !PIN_TRACKING!)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Jun 2020 20:21:58 GMT</pubDate>
    <dc:creator>DavidPike</dc:creator>
    <dc:date>2020-06-16T20:21:58Z</dc:date>
    <item>
      <title>select by attribute LIKE another attribute value</title>
      <link>https://community.esri.com/t5/arcmap-questions/select-by-attribute-like-another-attribute-value/m-p/441953#M981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to use Select by Attribute to select records where the value in one attribute is LIKE the value in another attribute, so for example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PIN_TRACKING LIKE '%PIN%'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where PIN_TRACKING is a list of PINs and I want to identify if PIN is listed in PIN_TRACKING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PIN&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PIN_Tracking&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1,2,3&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;4,5&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1,2,3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So for the above data it would select record 1 and 3 as the PIN is included in the list in PIN_TRACKING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2020 19:22:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/select-by-attribute-like-another-attribute-value/m-p/441953#M981</guid>
      <dc:creator>LJackson29</dc:creator>
      <dc:date>2020-06-16T19:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: select by attribute LIKE another attribute value</title>
      <link>https://community.esri.com/t5/arcmap-questions/select-by-attribute-like-another-attribute-value/m-p/441954#M982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;not sure where you are doing this... field calculator?, script? within the select by attribute, but conceptually&lt;/P&gt;&lt;P&gt;IF PIN is numeric and PIN_TRACKING is text...&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;p = 1

pt = '1,2,3'

str(p) in pt  # ---- where p and pt are their associated fields
True&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;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:46:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/select-by-attribute-like-another-attribute-value/m-p/441954#M982</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-12-11T19:46:22Z</dc:date>
    </item>
    <item>
      <title>Re: select by attribute LIKE another attribute value</title>
      <link>https://community.esri.com/t5/arcmap-questions/select-by-attribute-like-another-attribute-value/m-p/441955#M983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks - I am trying to do it in&amp;nbsp;Select by Attribute. Both are text fields.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2020 20:06:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/select-by-attribute-like-another-attribute-value/m-p/441955#M983</guid>
      <dc:creator>LJackson29</dc:creator>
      <dc:date>2020-06-16T20:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: select by attribute LIKE another attribute value</title>
      <link>https://community.esri.com/t5/arcmap-questions/select-by-attribute-like-another-attribute-value/m-p/441956#M984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I guess you want to do this interactively?&amp;nbsp; I could see doing it with a python script using a search cursor (&lt;STRONG&gt;untested!!&lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&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;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
fc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'C:\path\to\gdb\featureClass'&lt;/SPAN&gt;

fields &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'OBJECTID'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'PIN'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'PIN_Tracking'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeaturelayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'fcLyr'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'fcLyr'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fields&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        select &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'OBJECTID = row[0]'&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
            arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'fcLyr'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'ADD_TO_SELECTION'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;select&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;/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;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've always thought it would be cool to add a condition to the interactive select by attributes tool...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:46:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/select-by-attribute-like-another-attribute-value/m-p/441956#M984</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-12-11T19:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: select by attribute LIKE another attribute value</title>
      <link>https://community.esri.com/t5/arcmap-questions/select-by-attribute-like-another-attribute-value/m-p/441957#M985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bit of a stumper actually, I might just add a new field and run a field calculator expression on it to return 0 or 1 or something like that. then select by attributes where the new field = 1.&lt;/P&gt;&lt;P&gt;#pre-logic python&lt;/P&gt;&lt;P&gt;def checker(PIN, PIN_TRACKING):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if PIN IN PIN_TRACKING.split(","):&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = '1'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;else:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;result = '0'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;return result&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#window&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #3d3d3d; font-family: Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; 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;checker(!PIN!, !PIN_TRACKING!)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2020 20:21:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/select-by-attribute-like-another-attribute-value/m-p/441957#M985</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-06-16T20:21:58Z</dc:date>
    </item>
  </channel>
</rss>

