Select to view content in your preferred language

Serializing based on categories

176
1
08-08-2024 10:54 PM
Labels (3)
Lucavson
Occasional Contributor

Hello All, I am new in Arcade so I am wondering if I can generate Unique Codes in a field based on categories. 

So for example, Lets say I am working on a Local Government layer, which has a STATE column.  I want to learn a procedure or an Arcade Expression that can generate serialized code that begins from "0001" to the highest number of Local Government for each state. 

so if Bayelsa State has eight Local governments and Kano has 44 Local Governments, the UniqueCode field should  be populated with code such as ( for Bayelsa: BY0001 to BY0008) and (for Kano: KN0001 to KN0044).

Thank you 

1 Reply
VinceE
by
Frequent Contributor

Is this a one-time calculation? Or does this need to be dynamic, as your table undergoes changes?

What would happen if two rows got deleted, for some reason? So BY0001 and BY0002 were removed (accidentally maybe?), how would those IDs be assigned if those rows were added back in? Is there any reasons that once an ID is assigned, it must remain as that same ID? Or can these IDs be recalculated any time changes are made to the table, so that it is ensured that they are always unique?

I think if this is a one-time Field Calculate, this is straightforward, but perhaps less straightforward if this table will be changing a lot for some reason, and all those IDs need to be managed/updated on the fly.

0 Kudos