Quote:
Originally Posted by thiago.eec
Nice. Even simpler. Now I can find all authors without a note like this:
Code:
not template:"""program:
if $authors in has_note('authors', '') then
'1'
else
''
fi;#@#:t:1"""
|
That search finds books where all authors don't have notes, not any author that doesn't have a note. It compares two lists as strings, not as lists, so the "in" is true if the has_note() result string equals the authors string, which means all authors have notes.
It will also be at least 10 times slower than the
template I posted in the other thread. Perhaps as much as 50 times slower. Of course, this only matters if you have lots of books.
This template uses the new has_note() to find books where 1 or more authors don't have a note. It works by returning '1' if all authors for a book have notes, otherwise ''. It will be slightly faster than your template, but nowhere near as fast as the python template.
Code:
program:
if list_count(has_note('authors', ''), '&') ==# list_count_field('authors') then
return '1'
fi;
''
You could eliminate the outer "not" in the search by making changing the return '1' to return '' and changing the last line to '1'.