<?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: identify change in row sequence in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/identify-change-in-row-sequence/m-p/679438#M52648</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If my suggestion worked, please mark it correct to close the question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Aug 2019 14:22:43 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2019-08-23T14:22:43Z</dc:date>
    <item>
      <title>identify change in row sequence</title>
      <link>https://community.esri.com/t5/python-questions/identify-change-in-row-sequence/m-p/679435#M52645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to find a way of adding &amp;lt;Null&amp;gt; to a record when there a change in the data sequence on another field attribute...?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been trying to adapt this code to achieve this, but I'm struggling.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="font-size: 11px;"&gt;import arcpy&lt;/SPAN&gt;

&lt;SPAN style="font-size: 11px;"&gt;from arcpy import da&lt;/SPAN&gt;

&lt;SPAN style="font-size: 11px;"&gt;vertices = "dataset"&lt;/SPAN&gt;

&lt;SPAN style="font-size: 11px;"&gt;#set firstRow variable to true&lt;/SPAN&gt;
&lt;SPAN style="font-size: 11px;"&gt;firstRow = True&lt;/SPAN&gt;

&lt;SPAN style="font-size: 11px;"&gt;with arcpy.da.UpdateCursor(vertices, ["Shape", "Line_ID", "angle"]) as cursor:&lt;/SPAN&gt;

&lt;SPAN style="font-size: 11px;"&gt;for row in cursor:&lt;/SPAN&gt;
&lt;SPAN style="font-size: 11px;"&gt; name2 = row[1]&lt;/SPAN&gt;

&lt;SPAN style="font-size: 11px;"&gt;#check if its the first row&lt;/SPAN&gt;
&lt;SPAN style="font-size: 11px;"&gt; if firstRow == True:&lt;/SPAN&gt;
&lt;SPAN style="font-size: 11px;"&gt; name1 = name2&lt;/SPAN&gt;
&lt;SPAN style="font-size: 11px;"&gt; #set firstrow to false&lt;/SPAN&gt;
&lt;SPAN style="font-size: 11px;"&gt; firstRow = False&lt;/SPAN&gt;
&lt;SPAN style="font-size: 11px;"&gt; continue&lt;/SPAN&gt;
&lt;SPAN style="font-size: 11px;"&gt; row[2] = str(name1 - name2)&lt;/SPAN&gt;
&lt;SPAN style="font-size: 11px;"&gt; name1 = name2&lt;/SPAN&gt;
&lt;SPAN style="font-size: 11px;"&gt; cursor.updateRow(row)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The result should be something like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/457695_Attributes.jpg" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm rather new to UpdateCurser, so, generally don't know how it works. &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/sad.png" /&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:46:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/identify-change-in-row-sequence/m-p/679435#M52645</guid>
      <dc:creator>CliveCartwright</dc:creator>
      <dc:date>2021-12-12T16:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: identify change in row sequence</title>
      <link>https://community.esri.com/t5/python-questions/identify-change-in-row-sequence/m-p/679436#M52646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does this work for you?&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
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; arcpy &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; da

vertices &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"dataset"&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#set firstRow variable to true&lt;/SPAN&gt;
firstRow &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&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;UpdateCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
    vertices&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Line_ID"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"angle"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
    sql_clause&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;None&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"ORDER BY LINE_ID, OBJECTID"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&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;
    lid_prev&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ang_prev &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; next&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;cursor&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;updateRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;lid_prev&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; lid&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ang &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; lid &lt;SPAN class="operator token"&gt;!=&lt;/SPAN&gt; lid_prev&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
            cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;updateRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;lid&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        lid_prev &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; lid&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;/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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:37:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/identify-change-in-row-sequence/m-p/679436#M52646</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-12T04:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: identify change in row sequence</title>
      <link>https://community.esri.com/t5/python-questions/identify-change-in-row-sequence/m-p/679437#M52647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Much appreciated Joshua. Thank You.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Aug 2019 08:21:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/identify-change-in-row-sequence/m-p/679437#M52647</guid>
      <dc:creator>CliveCartwright</dc:creator>
      <dc:date>2019-08-23T08:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: identify change in row sequence</title>
      <link>https://community.esri.com/t5/python-questions/identify-change-in-row-sequence/m-p/679438#M52648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If my suggestion worked, please mark it correct to close the question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Aug 2019 14:22:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/identify-change-in-row-sequence/m-p/679438#M52648</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2019-08-23T14:22:43Z</dc:date>
    </item>
  </channel>
</rss>

