![]() |
#16 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
![]() |
#17 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 260
Karma: 49504
Join Date: May 2014
Device: Kobo Libra 2
|
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. |
![]() |
![]() |
Advert | |
|
![]() |
#18 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
#19 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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') ); Code:
final_sidx=finish_formatting( test(isInt, i, f), '', '', ': ' Series 02.5: Title |
![]() |
![]() |
![]() |
#20 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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') ); 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. |
![]() |
![]() |
Advert | |
|
![]() |
#21 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.
|
![]() |
![]() |
![]() |
#22 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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}"); |
![]() |
![]() |
![]() |
#23 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
![]() |
#24 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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), '', '', '. ' I need to research the difference between 'd' and 'f' formatting, I don't know this stuff and I'm just cookbooking here. |
![]() |
![]() |
![]() |
#25 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
![]() |
#26 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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} |
![]() |
![]() |
![]() |
#27 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 260
Karma: 49504
Join Date: May 2014
Device: Kobo Libra 2
|
Quote:
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. |
|
![]() |
![]() |
![]() |
#28 | ||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,450
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
The cmp function converts its input to float before comparing the values. Quote:
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 ); |
||
![]() |
![]() |
![]() |
#29 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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? |
![]() |
![]() |
![]() |
#30 | |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Jan 2016
Device: Kindle Paper White
|
Quote:
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. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
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 |