View Single Post
Old 05-16-2017, 12:25 PM   #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,453
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by bttrflii View Post
I'm quite comfortable with custom columns, and your solution is just what I needed. I changed the "6.2f" and "3d" to "5.2f" and "2d" respectively since I never have series that make it to 100, but with that minor tweak it's doing exactly what I wanted, and I now have sortable series information in book titles that are sent to my Kindle, and it's done without clutter for those series without decimal places.

Thank you SO MUCH, chaley!!!
You are welcome.

A note, because I should write this somewhere ...

While working on other calibre stuff today I made a change to the format_date function. The change will appear in calibre V3. Up to now the format_number template had to be enclosed in { } characters, meaning that format_number couldn't be used in Template Program Mode because the TPM template evaluator can't handle sub-templates. That is why I said you needed to use a General Program Mode template.

The change is that if a format template does not contain a { character then it is now assumed to be a number format specification and is treated accordingly. This means that starting with calibre V3, the following will work, eliminating the need for the extra column.
Code:
{series_index:'format_number($, contains($, '\.', '06.2f',  '03d'))'}
Of course, current format_number templates will continue to work.
chaley is offline   Reply With Quote