Select to view content in your preferred language

ArcGIS 3.0.2: What tool can select the records with the highest values in a particular field?

2592
15
Jump to solution
01-15-2024 03:18 AM
JamalNUMAN
Legendary Contributor

ArcGIS 3.0.2: What tool can select the records with the highest values in a particular field?

 

For example, in the screenshot below, I couldn’t figure out which tool can select the FOUR records with the highest population size in the “population” field

 

Clip_127.jpg

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
Tags (1)
15 Replies
Bud
by
Esteemed Contributor

I wonder if this would work in your model:

  1. Use the Sort geoprocessing tool to output a FC that is sorted by the population field (desc).
    Bud_2-1705560242179.png
  2. Use Select By Attributes or a definition query to isolate the first 4 ObjectIDs.
    Bud_4-1705560609719.png

Maybe that's the kind of thing @MErikReedAugusta had in mind in my ROW_NUMBER idea.

 

Somewhat related: Adding sequential numbers for the selected features

 

Tags (1)
DuncanHornby
MVP Notable Contributor

I had considered that approach too as it works just as well, the only "issue" would be that sort creates an output table and the user would need to deal with that (i.e. keep it or delete it). If I had taken this route I would probably have written it to an in-memory workspace.

Anyway nice to have shown two solutions for the question!

JamalNUMAN
Legendary Contributor

Many thanks guys for the help. It works fine

Clip_711.jpg

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
Bud
by
Esteemed Contributor

Top-n in primitive database (file geodatabase)

It's kind of brute force elimination and probably won't work right if there are rows with exact same value in population field.

population = (select max(population) from cities)
or population = (select max(population) from cities where population < (select max(population) from cities))
or population = (select max(population) from cities where population < (select max(population) from cities where population < (select max(population) from cities)))
or population = (select max(population) from cities where population < (select max(population) from cities where population < (select max(population) from cities where population < (select max(population) from cities))))

 Bud_0-1705860134733.png

 

0 Kudos
Bud
by
Esteemed Contributor
0 Kudos
JamalNUMAN
Legendary Contributor

I can live with the "sort" and "select" tools to find the records with the top values. However, this may not work correctly if two of the top records have the same value.

 

Clip_1448.jpg

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
0 Kudos