I am trying to create a unique ID for my street feature class. (My unique ID starts with first 3 letters of the Street Name, 2 letters of the Street type, and 3 letters of the City Name Abbreviated.) Where I am stuck is that I am trying to get a number to increment on the segments that would be duplicated. For example, Glenacre Drive has three segments. The UniqueID would be GLEDRHQF01, GLEDRHQF02, GELDRHQF03. I cant figure out how to create sequential numbers not based off of the ObjectID sorting... For example I used the following Field Calculator but realized it is looking at the ObjectID sort and my streets aren't entered in order...
Pre-Logic Script Code:
prevFieldValue = '' counter = 1 def GetDuplicateCounter(myFieldValue): global prevFieldValue global counter if myFieldValue == prevFieldValue: counter += 1 else: counter = 1 prevFieldValue = myFieldValue return counter
= GetDuplicateCounter( !UNIQUEID! )
Any Help would be Amazing! 🙂