You may have noticed that this post–ArcMap Field Calculator: Identifying Unique Cases, Single Field–specifies “Single Field”. Yes, that was my version of a cliff-hanger post.
The basic structure I listed in that post can be expanded on to satisfy your needs. The example in my earlier post was case sensitive for example, you could modify it so it treats “a” the same as “A”.
Today’s example groups records into different cases based off the values of two fields, !county_c! and !feature! and required only minor modifications.
The calling line was modified from:
to accommodate passing both values.
The function definition likewise was modified to accept two values, this:
def returnCase(inValue1, inValue2)
And this line was added, creating a list from the two values passed in:
inValue = [inValue1, inValue2]
(Note: The same results could have be achieved by using the original function by creating the list in the calling statement: returnCase([!county_c!,!feature!] )
caseList = [ ] def returnCase(inValue1, inValue2): inValue = [inValue1, inValue2] global caseList if not inValue in caseList: caseList.append(inValue) return caseList.index(inValue)