View Single Post
Old 10-11-2022, 09:13 AM   #7
Katja_hbg
Groupie
Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.Katja_hbg can grok the meaning of the universe.
 
Posts: 184
Karma: 158116
Join Date: Oct 2015
Device: Kobo Glo HD (landscape), Kobo Aura One
I just play around a bit and found a solution to show series "a of x"
But this maybe a performance issue and should not be used for a big library or only for subsets and in (normally) hidden columns.
There are a lot of example in the forum for number-format tweaking, if needed.

1. Preferences - Advanced - Tweaks - set "allow_template_database_functions_in_composit es = True" (only available with Calibre 6 and up)

2. Add column - "column built from other columns" and output "text"

3. Copy this code into the column template:

Code:
program: 
# Returns the series_index together with the last number in a series (or nothing for book with no series),  e.g. [2/5]

if field('series') then 
   this_series = field('series');
   books_in_series = book_values('title', 'series:="' & this_series & '"', ',', 0);
   highest_series_num = 0;	
   for title in books_in_series:
	title_index = book_values('series_index', 'title:="' & title & '"', ',', 0);
	if title_index > highest_series_num then
	    highest_series_num = title_index
	fi
    rof;
    series_idx_max = "["&field('series_index')&"/"&highest_series_num&"]"
else
    series_idx_max = ""
fi;
output = series_idx_max
Katja_hbg is offline   Reply With Quote