Sorting of groups inside a database seems wrong to me

Hey everyone,

Here’s something that’s been bothering me for a while now, but I can’t seem to find anything addressing this specific thing.

If you look at the screenshot attached (sorry for the crude mark-up), it seems to me that the sorting of groups inside of a database seems off. I opened the right click-menu, so you can see that it’s sorted ascending by name.

So then, shouldn’t groups starting with ‘2021…’ (marked in red) be grouped all together, and then those starting with ‘2022…’ (marked in blue)?

At least, that’s how the MacOS finder sorts folders.

Is this intended behaviour or a bug?

Thanks for any insights :slight_smile:

The first three groups are ‘2021 …’, ‘2022 …’, ‘2022 …’, then comes ‘202106 …’. That’s perfectly fine since the space (which follows the year in the first three groups) comes before any digit in ASCII, ISO and Unicode encodings.

And I doubt that the Finder would sort ‘202106’ before '2022 ’

It seems that you’d expect 202106 to follow 2021 and come before 2022. That, however, I’d only because you know that 202106 refers to the same year as 2021. DT doesn’t have this kind of deep insight.

You could try to add a space like so ‘2021 06’, but that might not be sufficient for what you’re trying to achieve.

1 Like

DEVONthink uses alphanumerical sorting, in this case by ascending numbers at the beginning. And actually the Finder uses the same sorting, which version of macOS and which system language do you use?

I exported the above folder to the Finder, and you’re right, they are sorted exactly the same. Sorry about that, it’s seems I’m remembering something wrong there…

1 Like

Thanks for that explanation. Though that’s where my thinking seems to differ? Maybe my reasoning is completely wrong though…

In my logic, if you sort this, you sort by the first character, ‘2’, then the second, ‘0’, then the third, ‘2’, and then the forth, in this case either ‘1’ or ‘2’. This would then end up grouping everything with a ‘1’ (so 2021) first, then with a ‘2’ (2022) second.

After that then comes either a space or a number, and here everything with a space would be sorted first, there I agree. But since the space, if any, is only in the 5th position, the 4th position should be sorted first though, no?

The complete numbers, not their digits are actually used for comparison.


Oooh… thinking and realizing

That’s the differene then. Not sure if it makes sense from a sorting point of view, but a least i can see how the system works.

I was grouping everything in ‘yyyymmdd’ which pertains to a specific date, then ‘yyyymm’ everything which spawns more than one date, then ‘yyyy’ for things spawning more than a month and as a fall back for anything else.

I think filling up empty spaces with zero’s then would fix this.

Thanks a lot for the help and your time everyone :smiley: This actually helped :+1: