View Single Post
Old 04-05-2023, 01:43 PM   #4
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,475
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
I am the person who gave you the template. However, this thread provides information that is a bit different so here is a different answer. This time I am using Template Program Mode instead of General Program Mode in hopes that is easier for you to maintain.

First comment: you say that you want to sort on
series_sort -> language -> series_index
However, your examples include the author. Does the author really play no role in the sort? Assuming it doesn't, here is a template that gives you what you are asking for.
Code:
{:'series_sort()'|| - }{:'language_strings($language, 1)'}{series_index:0>5.2f| - |}
Notes:
  • If there is no series, the output begins with the language. If you want it can have it do something else, such as output the string "No Series" (in your language).
  • If there is no language then nothing is output for it.
  • If there is no series then no series index is output.
Result:
  • A book in Dutch with no series will show "Dutch".
  • Book 3 of series Talon with no language will show "Talon - 3"
  • A book with no language and no series will show "" (empty string).

This template outputs the words "No Series" if there isn't a series, and the words "No Language" if there isn't a language. If there is no series then it doesn't output a series index.
Code:
{:'ifempty(series_sort(), "No Series")'|| - }{:'ifempty(language_strings($language, 1), "No Language")'}{series_index:0>5.2f| - |}
It might be better to output something other than "No ..." to ensure that the books sort more consistently. Perhaps
Code:
{:'ifempty(series_sort(), "*")'|| - }{:'ifempty(language_strings($language, 1), "*")'}{series_index:0>5.2f| - |}
To use these templates you create a composite column (Column built from other columns, not Behaves like tags). Use whatever you want as the lookup name, the column heading, and the description. Paste one of the two above templates into the template box. Choose "Text" as the Sort/search kind. You may or may not want to check the Show in Tag browser box -- my guess is that you don't because no entry will in more than one book. Don't check Show as HTML. This screen capture shows what I mean.
Click image for larger version

Name:	Clipboard02.jpg
Views:	229
Size:	49.1 KB
ID:	200815

Personally I would use
series_sort -> language -> series_index -> Title
so that books with no series are not in what appears to be a random order, falling back to title. This template does that.
Code:
{:'ifempty(series_sort(), "*")'|| - }{:'ifempty(language_strings($language, 1), "*")'}{series_index:0>5.2f| - |} ({title})
chaley is offline   Reply With Quote