Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 01-20-2016, 10:29 PM   #16
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,094
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
see the int( ?

That throws away the non integer portion
theducks is offline   Reply With Quote
Old 01-21-2016, 09:01 AM   #17
fogice
Addict
fogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Time
 
Posts: 260
Karma: 49504
Join Date: May 2014
Device: Kobo Libra 2
Quote:
Originally Posted by theducks View Post
see the int( ?

That throws away the non integer portion
Yes, I understand that. So, I see [01] and [01.5] as series indexes on my Kindle. However, [01.5] sorts before [01] . So does [ 01.5 ] before [ 01 ] . And 01.5: before 01: . And (01.5) before (01) . And 01.5, before 01, .

At least one of those should have flipped the sort order.
fogice is offline   Reply With Quote
Advert
Old 01-21-2016, 11:44 AM   #18
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,450
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
@fogice: could you give us the exact template you are using when you test "[ 01.5 ] before [ 01 ]"? Please wrap the template in CODE tags, the '#' when you are using advanced mode.

Does it work if you use 04.1f for all numbers? I ask because it could be the kindle that is choosing how and what to sort.
chaley is offline   Reply With Quote
Old 01-21-2016, 02:46 PM   #19
fogice
Addict
fogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Time
 
Posts: 260
Karma: 49504
Join Date: May 2014
Device: Kobo Libra 2
@chaley, thanks for your additional troubleshooting suggestions. Using 04.1f for all numbers does allow them to sort properly, so that takes that variable out of the equation. I'm using lina.w's final code, only tweaking the finish_formatting formula:
Code:
program:

sidx=field('series_index');
i=format_number(sidx, "{:02d}");
f=format_number(sidx, "{:04.1f}");
isInt=cmp(f, i, '', 'yes', '');
final_sidx=finish_formatting(
    test(isInt, i, f),
    '',
    ' [ ',
    ' ] '
);

# Add together the final result
strcat(
    field('series'),
    final_sidx,
    field('title')
);
Ideally, I would be using
Code:
final_sidx=finish_formatting(
    test(isInt, i, f),
    '',
    '',
    ': '
which would read
Series 02.5: Title
fogice is offline   Reply With Quote
Old 01-21-2016, 03:08 PM   #20
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,450
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
I don't have a paperwhite so I cannot test it there. Testing it in calibre using a custom column built from other columns, the following works:
Code:
program:

sidx=field('series_index');
i=format_number(sidx, "{:02d}");
f=format_number(sidx, "{:04.1f}");
isInt=cmp(f, i, '', 'yes', '');
final_sidx=finish_formatting(
    test(isInt, i, f),
    '',
    ' ',    <---- There is a space between the single quotes
    ' '     <---- There is a space between the single quotes
);

# Add together the final result
strcat(
    field('series'),
    final_sidx,
    field('title')
);
It produces the following:
Click image for larger version

Name:	Clipboard02.jpg
Views:	306
Size:	13.7 KB
ID:	145730

If the kindle sorts differently then all I can suggest is that it is doing something strange with the numbers, for example ignoring the decimal point and what follows.
chaley is offline   Reply With Quote
Advert
Old 01-21-2016, 05:25 PM   #21
fogice
Addict
fogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Time
 
Posts: 260
Karma: 49504
Join Date: May 2014
Device: Kobo Libra 2
Still mis-sorted on the Kindle Voyage. No idea why, perhaps someone else will know.
fogice is offline   Reply With Quote
Old 01-22-2016, 11:59 AM   #22
Divingduck
Wizard
Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.
 
Posts: 1,166
Karma: 1410083
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
Maybe this happen because you have more leading digits or decimal digits. I am using two decimal digits and 3 leading digits. For this I need to adjust the code to:
Code:
i=format_number(sidx, "{:03d}");
f=format_number(sidx, "{:06.2f}");
Divingduck is offline   Reply With Quote
Old 01-22-2016, 04:15 PM   #23
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,094
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
What is the sort direction on the voyage?
01.23
01

would make me guess descending

BUT all books would be affected

So the other difference is either a non-printing or a similar LOOKING character in the other data
theducks is offline   Reply With Quote
Old 01-23-2016, 10:44 AM   #24
fogice
Addict
fogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Time
 
Posts: 260
Karma: 49504
Join Date: May 2014
Device: Kobo Libra 2
Neat, two Ducks commenting in a row! Feels like the Boston Common in here.

The sort direction on the Voyage is
01.5
01
02.5
02

I just tried it with
Code:
final_sidx=finish_formatting(
    test(isInt, i, f),
    '',
    '',
    '. '
so that we get a trailing period, and even that didn't sort properly.

I need to research the difference between 'd' and 'f' formatting, I don't know this stuff and I'm just cookbooking here.
fogice is offline   Reply With Quote
Old 01-23-2016, 12:42 PM   #25
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,094
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Try and get your device to flip the sort direction arrow (to ascending)

That still does not take care of the trailing dot
theducks is offline   Reply With Quote
Old 01-23-2016, 01:29 PM   #26
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,450
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Does it sort correctly with this template? This template uses floating point numbers everywhere.
Code:
{series} {series_index:04.1f|| }{title}
chaley is offline   Reply With Quote
Old 01-23-2016, 02:02 PM   #27
fogice
Addict
fogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Time
 
Posts: 260
Karma: 49504
Join Date: May 2014
Device: Kobo Libra 2
Quote:
Originally Posted by chaley View Post
Does it sort correctly with this template? This template uses floating point numbers everywhere.
Code:
{series} {series_index:04.1f|| }{title}
Yes, that sorts properly (although it looks ugly).

Does format_number return a text value or a numerical value? I'm kind of confused about that, because it looks like text, but then we use cmp on its outputs, which looks like it would require a number.
( edit ) Nevermind, cmp converts to integer to make the comparison.

I also don't understand how strcat doesn't always include a non-null value for final_sidx, even when sidx is null.

Last edited by fogice; 01-23-2016 at 02:19 PM.
fogice is offline   Reply With Quote
Old 01-23-2016, 03:23 PM   #28
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,450
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by fogice View Post
Does format_number return a text value or a numerical value? I'm kind of confused about that, because it looks like text, but then we use cmp on its outputs, which looks like it would require a number.
( edit ) Nevermind, cmp converts to integer to make the comparison.
All template language functions return strings.

The cmp function converts its input to float before comparing the values.
Quote:
I also don't understand how strcat doesn't always include a non-null value for final_sidx, even when sidx is null.
format_number returns the empty string (not the null string) if the input value is empty. finish_formatting returns the empty string if the input value is empty. Thus
Code:
sidx=field('series_index');
i=format_number(sidx, "{:02d}");
f=format_number(sidx, "{:04.1f}");
isInt=cmp(f, i, '', 'yes', '');
final_sidx=finish_formatting(
    test(isInt, i, f),
    '',
    ' ',    <---- There is a space between the single quotes
    ' '     <---- There is a space between the single quotes
);
returns the empty string if sidx is empty. strcat is happy to concatenate the empty string, which of course does not change the result at all.
chaley is offline   Reply With Quote
Old 01-26-2016, 11:42 AM   #29
fogice
Addict
fogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Time
 
Posts: 260
Karma: 49504
Join Date: May 2014
Device: Kobo Libra 2
I give up.

I tried removing the Plugboard from the equation and manually put the series and index number directly into the titles for my set of sample books. They STILL don't sort properly.

I don't understand what Amazon was thinking when they wrote their alphabetical sort algorithm. There must be a way to make it work, but I'm stumped. Can anyone with a Kindle try this directly?
fogice is offline   Reply With Quote
Old 01-29-2016, 03:49 AM   #30
Morrigu
Junior Member
Morrigu began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jan 2016
Device: Kindle Paper White
Quote:
Originally Posted by fogice View Post
I give up.

I tried removing the Plugboard from the equation and manually put the series and index number directly into the titles for my set of sample books. They STILL don't sort properly.

I don't understand what Amazon was thinking when they wrote their alphabetical sort algorithm. There must be a way to make it work, but I'm stumped. Can anyone with a Kindle try this directly?
fogice, I ended up doing the same as you, editing the titles. And like you, still had the problem. Know what crazy thing worked? In calibre I sorted everything by title so it displayed properly. I couldn't leave it like that because the series would be mixed when there were multiple series, so I set it back to series sorting. Then when I transferred to the Kindle Paperwhite it displayed the books in the right order. Would never have thought of it, doesn't make sense to me, but it was a happy accident that I'm not going to complain about. (I literally clicked on the title column...thought nah, and then clicked back on the series column to sort)

Haven't gone back and put the code back in the plugboard to see if it still works that way. Will do that next time I add another big series.
Morrigu is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to have 3 decimals Arrow Library Management 3 12-16-2014 07:42 AM
Series Numbering .... GeoffC Library Management 3 05-02-2014 06:11 AM
Series numbering sometimes incorrect DrChiper Library Management 4 01-19-2012 10:56 AM
Kindle Annotations vs Plugboard rename Title with series initials/numbering Gwen Morse Devices 2 09-05-2011 12:58 PM
Series Numbering adrian1944 Calibre 3 10-17-2010 01:59 PM


All times are GMT -4. The time now is 11:15 AM.


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