View Single Post
Old 12-16-2023, 02:00 PM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,509
Karma: 8065348
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Here is something that works for me.

The template:
Code:
python:
def evaluate(book, context):
	db = context.db.new_api
	items_with_notes = context.globals.get('items_with_notes')
	if items_with_notes is None:
		items_with_notes = db.get_all_items_that_have_notes('authors')
		context.globals['items_with_notes'] = items_with_notes
	for aut in book.authors:
		if db.get_item_id('authors', aut) in items_with_notes:
			return '1'
	return ''
You set which category you are interested in by changing 'authors' to the category name of interest, e.g., tags.

The template search is:
Click image for larger version

Name:	Clipboard01.jpg
Views:	287
Size:	68.4 KB
ID:	205240

EDIT: This template is slow. See the template in post #10.

Last edited by chaley; 12-21-2023 at 12:00 PM. Reason: Link to post with a faster template.
chaley is offline   Reply With Quote