<?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: SearchCursor in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/searchcursor/m-p/26789#M2029</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It returns no value. It returns a error 000989: Python syntax error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="j-img-floatstart image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/499661_error.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji jive-image image-2 j-img-original" src="https://community.esri.com/legacyfs/online/499663_field_calculator.PNG" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Jul 2020 09:47:10 GMT</pubDate>
    <dc:creator>KristýnaSeimlová</dc:creator>
    <dc:date>2020-07-09T09:47:10Z</dc:date>
    <item>
      <title>SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/searchcursor/m-p/26783#M2023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN&gt;I try to find a match of numbers in the first column and second column, if it finds the same number in second column, it writes the value of the first column into third column. Do you have any ideas?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2020 08:38:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/searchcursor/m-p/26783#M2023</guid>
      <dc:creator>KristýnaSeimlová</dc:creator>
      <dc:date>2020-07-09T08:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/searchcursor/m-p/26784#M2024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kristyna,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've done something quite similar to this in the past! In this case you don't actually need to use cursors, just the field calculator using Python will do! If you right click on the third field (BELOW) and go to "calculate field", select "python" for the expression type, put the following code in the code block:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;myfunc&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;field1&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; field2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;field1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; field2&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; field1
    &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; None&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;Then in the box above the codeblock, put the following line&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;my_func&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;!NADR_GID!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !ABOVE!&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It should do exactly what you're hoping for it to do. Basically taking the first number, converting it to a string, looking for that sequence in the second field, then returning the first field's value if there is a match!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:05:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/searchcursor/m-p/26784#M2024</guid>
      <dc:creator>JoshuaSharp-Heward</dc:creator>
      <dc:date>2021-12-10T21:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/searchcursor/m-p/26785#M2025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why do you need a search cursor? you can use the field calculator for that&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;python parser&lt;/P&gt;&lt;P&gt;!NADR_ID! if !NADR_ID! == !ABOVE! else None&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2020 08:55:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/searchcursor/m-p/26785#M2025</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-07-09T08:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/searchcursor/m-p/26786#M2026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks! But there is one problem. Reason, why I tried to use SearchCursor is that I have more than one number in second culomn.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2020 09:11:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/searchcursor/m-p/26786#M2026</guid>
      <dc:creator>KristýnaSeimlová</dc:creator>
      <dc:date>2020-07-09T09:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/searchcursor/m-p/26787#M2027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;!NADR_ID! if !NADR_ID!&amp;nbsp;in !ABOVE! else None&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;try the 'in' operator&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2020 09:20:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/searchcursor/m-p/26787#M2027</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-07-09T09:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/searchcursor/m-p/26788#M2028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This shouldn't be an issue from my understanding, the multiple numbers in the second column are all just strings joined by ";"s, so if the number from the first column is anywhere in the second column it will return it. Have you tried running it? If so maybe you can show me where it has returned a value that you didn't want?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2020 09:21:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/searchcursor/m-p/26788#M2028</guid>
      <dc:creator>JoshuaSharp-Heward</dc:creator>
      <dc:date>2020-07-09T09:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/searchcursor/m-p/26789#M2029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It returns no value. It returns a error 000989: Python syntax error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="j-img-floatstart image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/499661_error.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji jive-image image-2 j-img-original" src="https://community.esri.com/legacyfs/online/499663_field_calculator.PNG" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2020 09:47:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/searchcursor/m-p/26789#M2029</guid>
      <dc:creator>KristýnaSeimlová</dc:creator>
      <dc:date>2020-07-09T09:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/searchcursor/m-p/26790#M2030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So in the original code I sent through, leave the field1 and field2 as they are (don't replace with your fields)! When you run myfunct(!NADR_GID!, !ABOVE!) that's substituting those values in there.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2020 09:55:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/searchcursor/m-p/26790#M2030</guid>
      <dc:creator>JoshuaSharp-Heward</dc:creator>
      <dc:date>2020-07-09T09:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/searchcursor/m-p/26791#M2031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately,&amp;nbsp;it returns still same error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2020 10:11:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/searchcursor/m-p/26791#M2031</guid>
      <dc:creator>KristýnaSeimlová</dc:creator>
      <dc:date>2020-07-09T10:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/searchcursor/m-p/26792#M2032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post another picture of what you ran this time?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2020 10:13:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/searchcursor/m-p/26792#M2032</guid>
      <dc:creator>JoshuaSharp-Heward</dc:creator>
      <dc:date>2020-07-09T10:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/searchcursor/m-p/26793#M2033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/499664_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2020 10:33:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/searchcursor/m-p/26793#M2033</guid>
      <dc:creator>KristýnaSeimlová</dc:creator>
      <dc:date>2020-07-09T10:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/searchcursor/m-p/26794#M2034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That really should run fine, I don't see how that's giving a syntax error, unless it doesn't like the indentation. In&amp;nbsp;any case I defer to Dan's solution which is running the same thing but in one line:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;!NADR_ID! if !NADR_ID!&amp;nbsp;in !ABOVE! else None&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2020 10:51:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/searchcursor/m-p/26794#M2034</guid>
      <dc:creator>JoshuaSharp-Heward</dc:creator>
      <dc:date>2020-07-09T10:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/searchcursor/m-p/26795#M2035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It doesn't work for me, but thank you so much for your help anyway.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2020 11:31:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/searchcursor/m-p/26795#M2035</guid>
      <dc:creator>KristýnaSeimlová</dc:creator>
      <dc:date>2020-07-09T11:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/searchcursor/m-p/26796#M2036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I realise that should be "NADR_GID" not "NADR_ID", where are you putting that line of code? It should be in the box below the code block, and the code block should be empty! If that fails, I'd be happy to take another look at the error message it gives.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also I realised in your previous screenshot&amp;nbsp;it's running as&amp;nbsp;Python9.3, try the above line or my original solution with "Python" as the expression type just in case!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2020 11:45:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/searchcursor/m-p/26796#M2036</guid>
      <dc:creator>JoshuaSharp-Heward</dc:creator>
      <dc:date>2020-07-09T11:45:04Z</dc:date>
    </item>
  </channel>
</rss>

