Numbering unique value -new column

713
3
01-22-2014 01:07 AM
Dd
by
New Contributor
hello
first of all - my english is basic 🙂 -sorry

I have a problem:
I want to paste contents from "column1" to "column2" with numbering, but i don't want "copy ID". I would numbering unique value anew.

For example:
Column1: Value in Column: A,B,B,B,C
I want to get: Column2: 1A,1B,2B,1C

Anyone know how to do it  in ARCGIS ?
Tags (2)
0 Kudos
3 Replies
JimCousins
MVP Regular Contributor
You want to do a sequential calculation. Have a look at:
http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000004s000000

Towards the bottom is "Accumulative and sequential calculations"
Best Regards,
Jim
0 Kudos
Dd
by
New Contributor
Thanks @jimcousins for answer

I don't know how i should do it..i try many times but still don't work (i never used python language) 

I used "Calculate the accumulative value of a numeric field."

Script:

Expression:
accumulate( !oznaczen_1! )

Expression Type:
PYTHON_9.3

Code Block:
total = 0
def accumulate(increment):
global total
if total:
  total += increment
else:
  total = increment
return total


Result Error:  ERROR 00539 ... accumulate "E"

Someone could write correct script ?

Column A: source data, for example: A,A,A, B,B,B AB1, AB2
Column B: empty -here i want get value: 1A,2A,3A, 1B,2B,3B, 1AB1 ...

thanks for any help
0 Kudos
JimCousins
MVP Regular Contributor
You have coded the accumulative value of a field, so basically record 1 + record 2 + record 3 + record 4.......
You should be using the calculate sequential ID or number based on an interval.
I see the following steps:
1) get a listing of unique values within the column ( if there are not too many, you could actually enter these into a list in the expression)
2) for each unique value, if the record == the value, run the sequential ID, appending the unique value to it. So if the input column = A, then it runs the code, if not, it goes to the next record, and if it = A, it runs the code.... then it switches to "B" and does the same sequence.
Regards,
Jim
0 Kudos