Quote:
Originally Posted by Soap-dodger
 You are so kind; your solution works excellently.
I am having difficulty in converting the result to an integer. I have read the relevant section of the Calibre manual to no avail. Here's what I've tried so far:
Code:
format_number(divide(words,pages), {0:3.0f});
format_number(divide(words,pages), "{0:3.0f}");
format_number(divide(words,pages), {0:,d});
format_number(divide(words,pages), "{0:,d}");
Either the manual could be clearer or I'm missing something.
Please, can you advise where I've got it wrong?
|
The one that worked for me was:
Code:
format_number(divide(words,pages), "{0:3.0f}");
But, if you do it in template mode, you need to remove the braces. So, it would be:
Code:
{:'format_number(divide(cmp(raw_field("#pages"),0,0,0,raw_field("#words")),cmp(raw_field("#pages"),0,1,1,raw_field("#pages"))), "3.0f")'}