View Single Post
Old 01-17-2024, 02:55 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: 11,774
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by raafayawan View Post
Thank you so much, can you please give me an idea what code exactly would I be using? Because from what I have tried, as a test, the text on Kobo says Plugboard Template Error: the function get_note can be used only in the GUI...
Ah yes, I forgot that plugboard templates don't have access to the database because they run as part of device integration. In this case the solution is:
  • Create a "Column built from other columns" without "behaves like tags". Use whatever lookup name and title you want.
  • Don't check the box "Show in tag browser"
  • The template for this column builds the text you want appended to the comments for the current book, using the get_notes() function as needed.
    Perhaps something like this if using HTML:
    Code:
    program: 
    # Assume notes from the first author. If all authors then a loop is required.
    	auth_notes = get_note('authors', sublist($authors, 0, 1, '&'), '');
    	series_notes = get_note('series', $series, '');
    
    	ans = '';
    	if auth_notes then
    		ans = $author & ' notes<br>' & auth_notes & '<br>'
    	fi;
    	if series_notes then
    		ans = ans & $series & ' notes<br>' & series_notes
    	fi
    Use the Template tester to check that the template is giving you what you want.
  • Check "contains HTML" if you are not using plain-text notes.
  • To avoid performance problems don't show this column in the book list. You might want to show it in book details to ensure it contains what you wish, removing it once you are sure.

Once you have the column created and showing what you wish, create a plugboard for "comments" with a template that combines the existing comment and the contents of the column created above. Something like
Code:
{comments}<br>{#lookup_name}
should work if using HTML, otherwise something like:
Code:
program: $comments & character('newline') & $#lookup_name
The above depends on what the Kobo does with comments. Is HTML accepted? Are newlines honored? I don't know.
chaley is offline   Reply With Quote