Quote:
Originally Posted by DrChiper
This comes to mind in the GUI search field:
Code:
template:"""{series_index}#@#:n:1"""
|
FWIW: this does the same thing using standard calibre search syntax.
Code:
series:true and series_index:=1
It is possible that the first book in the series doesn't have index 1. This template search finds the lowest index in each series.
Code:
template:"""program:
vals = globals(vals='');
if !vals then
all_series = book_values('series', 'series:true', ',', 0);
for series in all_series:
indices = book_values('series_index', 'series:="' & series & '"', ',', 0);
first = 1;
lowest = 9999999;
for index in indices:
if first || index <# lowest then lowest = index; first = '' fi
rof;
vals = list_union(vals, series & ':' & lowest, ',')
rof;
set_globals(vals)
fi;
if $series && $series_index ==# select(vals, $series) then '1' fi#@#:b:yes"""
If you use the Advanced search dialog, the template is this:
Code:
program:
vals = globals(vals='');
if !vals then
all_series = book_values('series', 'series:true', ',', 0);
for series in all_series:
indices = book_values('series_index', 'series:="' & series & '"', ',', 0);
first = 1;
lowest = 9999999;
for index in indices:
if first || index <# lowest then lowest = index; first = '' fi
rof;
vals = list_union(vals, series & ':' & lowest, ',')
rof;
set_globals(vals)
fi;
if $series && $series_index ==# select(vals, $series) then '1' fi
The template search dialog is this:
EDIT: if you store the above as a saved search then you can create a virtual library showing the lowest book.