View Single Post
Old 10-25-2024, 02:01 PM   #743
Wiggo
Leftutti
Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.
 
Wiggo's Avatar
 
Posts: 549
Karma: 1717097
Join Date: Feb 2019
Location: Bavaria
Device: iPad Pro, Kobo Libra 2
list_count_field

I have a column #series authors (thx chaley)

Spoiler:
Code:
python:
def evaluate(book, context):
    if book.series is None:
        return ''
    db = context.db.new_api
    ans = set()
    # Get the list of books in the series
    ids = db.search(f'series:"={book.series}"', '')
    if ids:
        # Get all the author_sort values for the books in the series
        author_sorts = (v for v in db.all_field_for('author_sort', ids).values())
        # Add the names to the result set, removing duplicates
        for aus in author_sorts:
            ans.update(v.strip() for v in aus.split('&'))
    # Make a sorted comma-separated string from the result set
    return ', '.join(v.replace(',', ';') for v in sorted(ans))


And I have a column symbol for more than one series author
Code:
program:
	if list_count($#series_authors, ',') > 1 then
		'series_authors.png'
	fi
I wanted to replace list_count by list_count_field but I get an error
Code:
program:
	if list_count_field('#series_authors') > 1 then
		'series_authors.png'
	fi
Click image for larger version

Name:	calibre_qcZIUEVOZW.jpg
Views:	665
Size:	121.6 KB
ID:	211650

I installed Calibre 7.20.100 but as always, I have no idea.
Wiggo is offline   Reply With Quote