View Single Post
Old 08-25-2019, 03:41 PM   #2
China Diapers
Member
China Diapers began at the beginning.
 
Posts: 21
Karma: 10
Join Date: May 2011
Device: PRS-600
Quote:
Originally Posted by China Diapers View Post
I have created the below template:

program:format_number(test(field('#duration'),divi de(field('#page_count'),field('#duration')),0),"{0 :5.1f}");

What I was intending it would do is return 0 where the 'duration' field is blank (thereby avoiding division by zero) else the quotient of page count divided by duration value.

What is actually happening is the result is never 0, it is either the quotient or a division by zero error, so it appears the test is ignored or I am misunderstanding the purpose of the test function.

Screenshot attached for context.

Any ideas?
That said, the below returns true where the duration value is populated, and false where it is not as I would expect.

program:test(field('#duration'),"True","False");
China Diapers is offline   Reply With Quote