Quote:
Originally Posted by kevn57
This is a repost as I posted in the wrong thread
I'm a complete nube in calibre template language.
I'm trying to take the output of the plugin Pagecount which is the number of words in a book and dividing that by 320 which is my words per minute reading rate and output the total number of minutes to read the book into my custom integer col "#minutes"
I don't know how to assign the product of divide(vals, 320); to my custom column #minutes.
program:
col = '#pagecount';
vals = from_selection(col);
'#minutes' = divide(vals, 320);
But I get this result EXCEPTION: Formatter: Expected end of program, found '=' near '#minutes' on line 4
|
Where do you want to use the template? I ask because you are using from_selection() that only works in action chains. If you want a composite column (built from other columns) with the lookup name '#minutes' then you would use this template for the column.
Code:
program:
$$#pagecount / 320
If you don't want fractional minutes then use
Code:
program:
floor($$#pagecount / 320)
or
Code:
program:
round($$#pagecount / 320)