Sort output labels by value ascending

4403
7
04-28-2015 06:49 AM
AdrianJuarez
Esri Contributor

Looking for some input regarding the expression required to sort output labels (ascending) based off of a specific value. I have a table of ethnic population values for administrative districts (row) and ethnicities (column). I have attached a sample table for reference. Any help is greatly appreciated.

0 Kudos
7 Replies
SepheFox
Frequent Contributor

Hi Adrian,

I'm not certain what you mean by "the expression required", but you can either sort by right clicking the field heading in the attribute table, or using the Sort tool: ArcGIS Desktop

0 Kudos
AdrianJuarez
Esri Contributor

Sorry for not going into greater detail. What I am trying to do is use a label expression via layer properties to sort through columns within my table then sort the output labels on my map based off of values ascending. I am aware of the sort ascending / descending within the table / feature class, I think what I am trying to do is a bit more than that.

0 Kudos
SepheFox
Frequent Contributor

Did you look at the Sort tool I mentioned? It creates a new feature class which is already sorted.

0 Kudos
AdrianJuarez
Esri Contributor

We are only licensed at the basic level within the org I currently support.  I am going to try this at home later tonight. Thanks for the info.

0 Kudos
DarrenWiens2
MVP Honored Contributor

You are talking about sorting columns, not rows, correct? For example, in your spreadsheet, "Armenian" would always come first.

0 Kudos
AdrianJuarez
Esri Contributor

Darren, I have attached an example of my current labeling expression and what my labeling currently looks like.

" Armenian: " & [Armenian_M2] &vbnewline& "Aromenian:" & [Aromenian_M2] &vbnewline&...etc

Armenian: 5%

Aromenian: 12%

Greek: 30%

Macedonian: 2%

This is what my output labels need to look like and I would like to use the label expression to make it happen. Sorted by values descending

Greek: 30%

Aromenian: 12%

Armenian: 5%

Macedonian: 2%

0 Kudos
SepheFox
Frequent Contributor

Oh, now I see what you are trying to do! It looks like these folks did just that, using  a field called "top_depth_inches" to sort the label: Displaying a multi-row table label in ArcGIS using Python | wolfmapper

0 Kudos