Select to view content in your preferred language

Specify how nulls are sorted in the attribute table (nulls first or last)

2715
11
06-21-2022 08:38 AM
Status: Open
Labels (1)
Bud
by
Esteemed Contributor

When sorting a field in the attribute table, it would be helpful if we could specify how nulls are handled (NULLS FIRST vs. NULLS LAST).

For example (Oracle), I want to sort a date field descending so that the latest dates are at the top. But when I do that, 1) nulls are at the top, then 2) the latest dates are shown next, then 3) the first dates. 

Bud_0-1655824079031.png

That's a nuisance when dealing with large tables. I need to painstakingly scroll down through nulls to get to the first instance of a non-null date in the list. (In my case, I had to scroll through 10,000 nulls...and then look for where the nulls stop and the dates start)

Sorting in ascending order doesn't help either.

It would be better if I could specify that I want the nulls to be last in the list, even though I'm sorting descending.

Maybe something like this:

Bud_2-1655824764508.png

Would something like that be possible?

 

Related: Allow using the ORDER BY clause in definition queries (SQL)

11 Comments
AndrewQuee

Sure!  Here's the documentation for it: ArcGIS Pro: Set the active definition query 

Here's the project in question.  As you can see I have multiple '<attribute>IS NULL' queries defined.  I can toggle them on and off fairly easily from Layer Properties.

Choosing an active definition query from the list of defined queriesChoosing an active definition query from the list of defined queries

 

 

This is a great feature in Pro for often-used  views on a layer, noting you can only have one active at one time, so it's not quite a radio-button toggle panel.  Previously you would need to have multiple layers with different definition (restriction) queries defined.  

It would still be useful to leave nulls in and have nulls first or last as you can accidentally leave a  restriction query on and them come back months later to wonder where the data went. 🙂