I have limited expertise with Python.
I need to create labels based on groups of attributes. I've figured out a clumsy way to accomplish this but it involves 20 different annotation classes / SQL queries / label expressions, and I really hope there is a way to accomplish this more elegantly and efficiently, ideally with just 1 label expression.
My input data (which cannot be altered) is a feature class with 3 relevant fields (which I've made generic here).
- Codelist - numeric codes
- Attribute1 - an attribute
- Attribute2 - a second attribute
Codelist contains 100 numbers. Groups of these numbers require one label - for example codes 1,3,35,7,8 would get the label "Christmas, Attribute1, Attribute2" on 3 separate lines. Codes 2,9,34,100,54,22 would get the label "Easter, Attribute 1, Attribute2" on 3 separate lines. Etc etc.
I can't figure out how to use an SQL-like 'if [CODELIST] in (1,3,35,7,8):' statement in the Python label expression builder.
Is it possible?
Am I approaching this the right way or is my first effort using multiple annotation classes and SQL queries the best way to do this after all?
Attribute1
andAttribute2
are the same for all the codes, right?