sequential number for each class in a field

Discussion created by nadeem41 on Aug 27, 2013
Latest reply on Aug 27, 2013 by jskinner-esristaff
hello everyone.
i know a script which is used for sequential number generation in a field. the script is given below.

Expression Type:

Code Block:
def autoIncrement():
global rec
pStart = 1 #adjust start value, if req'd
pInterval = 1 #adjust interval value, if req'd
if (rec == 0):
  rec = pStart
  rec = rec + pInterval
return rec

this is very useful when we want to calculate the sequence number for whole field.
but i am looking for same thing in a different manner. i have point shapefile which have different classes, each class have more then 100 records. i want to generate the sequence number for each class in a single field. e.g..
class1= 101 records, class2=105 records, class3=110 records.these records are present in classes field
i have another field name seq.numer. in this field i want to generate sequential number for each class in this field starting from 1 for each class. i hope you understand what i mean.
Nadeem Fareed