Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre Companion

Notices

Reply
 
Thread Tools Search this Thread
Old 10-02-2016, 03:05 PM   #1
rmzg
Member
rmzg began at the beginning.
 
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?
rmzg is offline   Reply With Quote
Old 10-02-2016, 05:15 PM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
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:
Originally Posted by rmzg View Post
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?
{id} is an Integer, not text

You could pad those with less than 5 digits with leading 0's using Bulk Mode Search and Replace you have 8000 already, so I suggest 5 digits now and worry when you hit 100K
theducks is offline   Reply With Quote
Advert
Old 10-07-2016, 07:16 PM   #3
rmzg
Member
rmzg began at the beginning.
 
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?
rmzg is offline   Reply With Quote
Old 10-07-2016, 09:46 PM   #4
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,896
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
Quote:
Originally Posted by rmzg View Post
And I mean, I know it is an integer, can companion not sort integers at all?
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.
DoctorOhh is offline   Reply With Quote
Old 10-08-2016, 01:37 AM   #5
rmzg
Member
rmzg began at the beginning.
 
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
rmzg is offline   Reply With Quote
Advert
Old 10-08-2016, 02:20 AM   #6
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,896
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
Quote:
Originally Posted by rmzg View Post
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
It looks like I was confused. The way you created the column I would have assumed that CC would sort it accurately. It certainly sorts accurately in calibre.

I guess @chaley will have to let us know why the sort is off or what we are missing.
DoctorOhh is offline   Reply With Quote
Old 10-08-2016, 02:48 AM   #7
rmzg
Member
rmzg began at the beginning.
 
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.
rmzg is offline   Reply With Quote
Old 10-08-2016, 03:29 AM   #8
rmzg
Member
rmzg began at the beginning.
 
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.
rmzg is offline   Reply With Quote
Old 10-08-2016, 04:04 AM   #9
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
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}
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 04:00 PM.


MobileRead.com is a privately owned, operated and funded community.