View Single Post
Old 01-16-2011, 04:53 AM   #12
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,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Here is a better version of the last template program. The original was throwing exceptions that didn't hurt anything but cluttered up the log. This one avoids that by ensuring that only numbers are passed to the cmp function.

Code:
program:
	comments = field('comments');
	percent = re(comments,	'(?is).*last page read: location \d+ \((\d+)%\).*', '\1');
	contains(	comments,
				'(?i).*?last page read: location', 
				cmp(switch(percent, '^\d*$', percent, 0),
					94,
					'No',
					'No',
					'Yes'),
				'Unopened')
chaley is offline   Reply With Quote