Quote:
Originally Posted by chaley
"Best" depends on you.
There are two general approaches. The first is to use a "Column built from other columns" (a "composite" column) where the template computes the value you want in the column for the book. The second is to use the Action Chains plugin to compute the column contents on when you ask it to. I'll talk about the first. If you want to know about Action Chains then see that plugin's thread.
Here is a template for a composite column that might do most of what you want.
Code:
program:
if $$#kobopct ==# 100 then
whenfinished = $$#kobolastread
else
whenfinished = $$#read
fi;
whenfinished
For the language syntax look in the General Program Mode section of the calibre template language documentation. If you are going to ask more questions about this then I suggest you make a separate thread.
You might want to format the dates, in which case you would use the format_date() function after the fi, as in
Code:
whenfinished = format_date(whenfinished, 'whatever format')
|
Thank you. While I investigate that, why does this get an error as Column built from other columns?
Code:
{#kobopct: 'cmp($,100,#read,#kobolastread,#read)'}
I had thought it would compare #kobopct to 100, the choose the value (if any) from either #read or #kobolastread and put that into the whenfinished column. Instead I get a template error.