04-05-2023, 10:11 AM | #1 |
Junior Member
Posts: 3
Karma: 10
Join Date: Apr 2023
Device: none
|
Make composite column series_sort
I'll start with saying I have no programming background. And this is the first time I'm trying something like this in Calibre. First time posting here also.
I have several series with the same name. I want to have them sorted so they are directly behind eachother. But I want each language seperate. I want to sort like this: series_sort -> language -> series_index ex.: Talon by Julie Kagawa What I want: Talon [1] - Talon - Julie Kagawa - English Talon [2] - Rogue - Julie Kagawa - English ... Talon [1] - Pupil - Julie Kagawa - Dutch Talon [2] - Rebel - Julie Kagawa - Dutch ... What I get is: Talon [1] - Talon - Julie Kagawa - English Talon [1] - Pupil - Julie Kagawa - Dutch Talon [2] - Rogue - Julie Kagawa - English Talon [2] - Rebel - Julie Kagawa - Dutch ... (Because when you sort, you only have the option series. You sort then by series_sort as well as series_index. You don't have the option to sort by series_sort. I can make a new column series, but then it doesn't take the artikels into account, which is super annoying. So to fix this I want to make a composite column series_sort. However I keep running into problems. I have tried entering: series_sort series_sort() {series_sort} {series_sort()} Please help!! If you help, please do it step by step. Where I need to go, where I need to type in the data, best if I can do copy/paste. Because otherwise I have no idea or experience with templates and stuff. I received this from one of the creators but I have absolutely no idea where I need to imput this. What I need to do. program: sort = series_sort(); lang = finish_formatting(language_strings($language, 1), '', ' - ', ''); if sort then strcat(series_sort() & lang & ' - [' & $series_index & ']') else 'No series' fi Thank you |
04-05-2023, 10:43 AM | #2 |
Well trained by Cats
Posts: 29,969
Karma: 55705602
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Sorts are always by priority (the order)
You sorted by series so Language is lower priority If you want by Language ,That needs to be the last (most current sort in the Library view) . Calibre biases sort by the previous sort. Sort by Title, then by Author and you will see that authors books in Title order. Also, you can't have conflicting sorts (that work ) You can't sort by Title and series_index (unless it is the Alphabet Murders ) |
04-05-2023, 01:05 PM | #3 |
Junior Member
Posts: 3
Karma: 10
Join Date: Apr 2023
Device: none
|
Yes, I am aware of that but, what I'm wondering about is how to make a custom column series_sort (like you can do for author_sort). That would make of for example The Witcher, the value Witcher.
With view manager or sort by you can prioritise sorting, do multiple. But because sorting of series is done immediately for both series_sort and series_index, the secundary sort has no effect other than putting Dutch/English/Dutch/English... or English/Dutch/English/Dutch (example previous post, what i get). And if I start to sort with language, then the series isn't grouped together anymore, there are then several large groupings of the same language. To be able to get the grouping I want, I need to be able to sort like: high priority -> low series_sort (custom column) -> languages -> series_index (custom column, this I know how to make) Last edited by slb; 04-05-2023 at 01:07 PM. |
04-05-2023, 01:43 PM | #4 |
Grand Sorcerer
Posts: 11,779
Karma: 7029971
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| - |}
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| - |} Code:
{:'ifempty(series_sort(), "*")'|| - }{:'ifempty(language_strings($language, 1), "*")'}{series_index:0>5.2f| - |} 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}) |
04-05-2023, 03:01 PM | #5 |
Junior Member
Posts: 3
Karma: 10
Join Date: Apr 2023
Device: none
|
Hey Chaley
Thank you for the extra information, although I think it wasn't yet what I was searching for. I found just a few minutes earlier a solution. I did a custom column with this as argument: {series:swap_around_articles()} And for the sorting of the articles in all languages to apply. I did as instructed in this post: https://www.mobileread.com/forums/sh...d.php?t=201578 Then I used View Manager to sort: series_sort (custom column) -> languages -> series -> title Last edited by slb; 04-05-2023 at 03:06 PM. |
04-05-2023, 03:09 PM | #6 | |
Grand Sorcerer
Posts: 11,779
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
|
|
04-09-2023, 12:52 PM | #7 |
Grand Sorcerer
Posts: 11,779
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
As of calibre 6.15 the series_sort() function uses the book's language.
|
Tags |
custom column, custom columns, series order, series organization, series sort |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help with a composite column | ownedbycats | Library Management | 2 | 07-08-2020 10:06 AM |
Need help with composite column | BookJunkieLI | Library Management | 2 | 07-03-2019 11:42 AM |
Composite Column | BetterRed | Calibre | 12 | 09-01-2013 04:58 AM |
Set value of another column from composite? | dirgeon | Library Management | 1 | 02-03-2013 11:40 AM |
Composite column or not ? | Bertrand | Library Management | 3 | 08-24-2011 01:27 AM |