View Single Post
Old 10-28-2024, 11:02 AM   #156
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,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
28 Oct 2024 (in calibre 7.21)
  • Improvement to template function has_notes. It now has two variants.
    1. has_note(field_name, field_value) -- if field_value is not '' (the empty string) , return '1' if the value field_value in the field field_name has an attached note, otherwise ''. Example:
      Code:
      has_note('tags', 'Fiction')
      returns '1' if the tag "fiction" has a note, otherwise ''.
    2. (NEW) has_note(field_name, '') -- if the second parameter is '' then return a list of values in field_name that have a note. If no item in the field has a note, return ''. Example:
      Code:
      has_note('authors', '')
      returns a list of authors that have notes, or '' if no author has a note.
    For example, the second variant is useful for showing column icons if any value in the field has a note rather than a specific value.

    You can also test if all the values have a note by comparing the list length of this function's return value against the list length of the values in field_name. Example:
    Code:
    list_count(has_note('authors', ''), '&') ==# list_count_field('authors')

Last edited by chaley; 11-21-2024 at 10:14 AM.
chaley is offline   Reply With Quote