Quote:
Originally Posted by ownedbycats
Question: Could book_values be used to check how many books in a series have a #percentread of 100, then return a value (e.g. read series, unread series, partially read series) based on that? This would probably be best done as a template search.
|
Sure. Something like this
Edited:
Code:
program:
vals = globals(vals = '');
if !vals then
all_series = book_values('series', 'series:true', ',', 0);
for series in all_series:
count = book_count('series:="' & series & '"', 0);
reads = book_values('#myint', 'series:="' & series & '"', ',', 0);
ans = '';
# I assume that an unread book has an undefined read percentage, not 0%
# If the reads list is empty then no book has a defined value
if list_count(reads, ',') == 0 then
ans = 'Unread series'
fi;
for i in reads:
# If any book isn't 100 then partially read
if i != 100 then
ans = 'Partially read series'
fi
rof;
if !ans then
ans = 'Read series'
fi;
vals = list_join(',', vals, ',', series & ':' & ans, ',')
rof
fi;
select(vals, $series)