![]() |
#1 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 125
Karma: 295674
Join Date: Jul 2021
Device: iPhone
|
Proper alphanumerical sorting on tag browser
Hello! I made a template function to group word counts by certain thresholds and used it for a custom column where the results are shown on the tag browser, but they're not being sorted properly on the tag browser. It seems to only see the first digit on 5000, 10000, etc. The custom columns are already sorted by text. Same case for tags with numbers though I'm not sure if that's the intended behavior.
This is the template function with the template name getWordCountGroup. Code:
program: getWordCount = field('#ao3_words'); wordCount = re(getWordCount, '[,]', ''); first_non_empty( cmp(wordCount, 5001, 'Less than 5000', '', ''), cmp(wordCount, 10001, 'Less than 10000', '', ''), cmp(wordCount, 20001, 'Less than 20000', '', ''), cmp(wordCount, 40001, 'Less than 40000', '', ''), cmp(wordCount, 80001, 'Less than 80000', '', ''), 'Over 80000' ); |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,363
Karma: 27230406
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I doubt the tag browser sorting recognizes numbers inside text fields when sorting. It would be a significant performance hit.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 125
Karma: 295674
Join Date: Jul 2021
Device: iPhone
|
One workaround I can do is adding a space before 5000 so it gets placed at the top of the list.
|
![]() |
![]() |
![]() |
#4 | |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,981
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Quote:
Template: Spoiler:
|
|
![]() |
![]() |
![]() |
#5 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,064
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
|
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,981
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
It's a composite column, sorted by text.
|
![]() |
![]() |
![]() |
#7 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,064
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
|
![]() |
![]() |
![]() |
#8 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 125
Karma: 295674
Join Date: Jul 2021
Device: iPhone
|
I still don't understand the difference between mine and ownedbycats'. I've even changed the template to use switchif(). Same result for either composite column type.
The word count column the template is taking values from is an Integer type with the format {:,d} Spoiler:
|
![]() |
![]() |
![]() |
#9 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Is this option checked in Preferences / Behavior?
|
![]() |
![]() |
![]() |
#10 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 125
Karma: 295674
Join Date: Jul 2021
Device: iPhone
|
![]() ![]() |
![]() |
![]() |
![]() |
#11 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,981
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I actually looked for a setting like that... but in tweaks.
![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sorting of months in Tag Browser | ownedbycats | Library Management | 2 | 09-01-2022 03:09 PM |
Hierarchical tags and sorting in tag browser | ownedbycats | Calibre | 4 | 06-08-2020 07:01 PM |
Tag Browser - Numerical sorting bonked? | Lofwyr23 | Calibre | 3 | 06-14-2014 06:28 PM |
Tag Browser is not sorting at all | RennyM | Library Management | 5 | 05-05-2014 07:30 PM |
Sorting tag values in tag browser | mcam | Library Management | 15 | 08-25-2013 05:50 AM |