I am developing a script to calculate the values of two fields (C and D) based on value of field A (It is a Point feature):
A C D
0.2 1 1
0.2 1 2
0.2 1 3
0.4 2 1
0.5 3 1
0.5 3 2
So the idea is
n = 1
k =0
while i < endrow
{
if a[i]==a[i+1]
c[i]=n
d[i] = k+1
if a[i] < a[i+1]
i=i+1
k=0
c[i]=n+1
d[i]= k+1
}
Not sure - cursor can help me. But is there any way for such comparison and update the column?
Thanks
adding another complication- field E which has the maximum D for every unique A or C; so it will be:
A C D E
0.2 1 1 3
0.2 1 2 3
0.2 1 3 3
0.4 2 1 1
0.5 3 1 2
0.5 3 2 2
Because my ultimately goal is to keep only D ==1 and label the remained points with C and E (say: there are 3 points at location 1)
A C D E
0.2 1 1 3
0.4 2 1 1
0.5 3 1 2
Right now appears, I have to run another combination of search and update cursor after calculation of C and D but if there is any other concise and sleek approach! If I will figure it out - I will post it here!