![]() |
#1 |
Member
![]() Posts: 21
Karma: 10
Join Date: Sep 2016
Device: Note5
|
Sorting on numeric custom columns?
In a desperate attempt to get calibre to show the actual order in which I've added books I created a custom column that shows calibre's internal id for each book, which conveniently is a simple integer that increments every time you add a book.
I've told CC to add this custom column to be available to sort by, and it is, except it sorts in ascii mode such that 900 comes after 8000, which is slightly awkward. How to fix? |
![]() |
![]() |
![]() |
#2 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,047
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:
You could pad those with less than 5 digits with leading 0's using Bulk Mode Search and Replace ![]() ![]() |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Member
![]() Posts: 21
Karma: 10
Join Date: Sep 2016
Device: Note5
|
Am I supposed to use bulk mode from companion or calibre itself? How will this handle new books that are added/transferred?
And I mean, I know it is an integer, can companion not sort integers at all? |
![]() |
![]() |
![]() |
#4 |
US Navy, Retired
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,896
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
|
I think his point is the custom column type has to be an integer custom column and not a text custom column type. You can place numbers in a text custom column, but I suspect a text column will sort on ascii, thus the suggestion to pad the numbers with zeros. Is your custom column a text type or integer type custom column?
Last edited by DoctorOhh; 10-07-2016 at 09:48 PM. |
![]() |
![]() |
![]() |
#5 |
Member
![]() Posts: 21
Karma: 10
Join Date: Sep 2016
Device: Note5
|
I'm still a little confused what you mean by text vs integer columns, is this the setting inside calibre itself? This is how I created the actual column.
Are you suggesting I change the template to display padded with zeroes? http://i.imgur.com/VyACh2i.png |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
US Navy, Retired
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,896
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
|
Quote:
I guess @chaley will have to let us know why the sort is off or what we are missing. |
|
![]() |
![]() |
![]() |
#7 |
Member
![]() Posts: 21
Karma: 10
Join Date: Sep 2016
Device: Note5
|
I think I discovered something, if you select "column built from other columns, behave like tags" then you get some additional options, one of which is ...
Ok I thought there was something different but now I'm just confused. I built a new column with "behave like tags" and it seems to be sorting more accurately but it's a bit glitchy inside companion. |
![]() |
![]() |
![]() |
#8 |
Member
![]() Posts: 21
Karma: 10
Join Date: Sep 2016
Device: Note5
|
Reply to myself: Ha Ha just kidding! It kinda sorta worked after I resynced then I ran 'rebuild database' and now it's back to sorting as a string. INFINITE SADNESS.
|
![]() |
![]() |
![]() |
#9 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,444
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
CC sorts custom integer and float columns as numbers.
Composite columns are always text, the result of evaluating a template, and that is how CC sorts them. CC does not take the calibre "sort hint" into account. If you want a "id" composite column to sort like a number in CC then you must fill it with leading zeros using something like Code:
{id:09d} |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Custom Columns | docmartn | Library Management | 3 | 08-30-2016 02:18 PM |
Sorting fanfiction by like/dislike ratio using custom columns? | crackshot91 | Library Management | 6 | 11-26-2013 02:47 PM |
sorting by two columns | BeccaPrice | Calibre | 9 | 01-22-2012 05:54 AM |
Custom Columns - How are you using yours? | nynaevelan | Library Management | 19 | 04-18-2011 12:42 AM |
0.7.46 and custom columns | meme | Library Management | 4 | 02-21-2011 04:21 AM |