AnsweredAssumed Answered

identify change in row sequence

Question asked by Cheekychives on Aug 22, 2019
Latest reply on Aug 23, 2019 by bixb0012

I'm trying to find a way of adding <Null> to a record when there a change in the data sequence on another field attribute...?

 

I've been trying to adapt this code to achieve this, but I'm struggling. 

 

import arcpy

from arcpy import da

vertices = "dataset"

#set firstRow variable to true
firstRow = True

with arcpy.da.UpdateCursor(vertices, ["Shape", "Line_ID", "angle"]) as cursor:

for row in cursor:
name2 = row[1]

#check if its the first row
if firstRow == True:
name1 = name2
#set firstrow to false
firstRow = False
continue
row[2] = str(name1 - name2)
name1 = name2
cursor.updateRow(row)

The result should be something like this: 

 

I'm rather new to UpdateCurser, so, generally don't know how it works.  

Outcomes