View Single Post
Old 03-06-2021, 06:02 PM   #2
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: 12,383
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Yes, with a GPM template. The following example shows you how to do the test. Up to you to figure out what you want to do in each case.
Code:
program: 
	x = raw_field('#myint');
	if x == 'None' then
		'Not Set'
	else
		strcat('Is Set to ', x)
	fi
In the latest calibre release, raw_field() takes an optional second parameter specifying what to return if the field isn't defined. Example:
Code:
	x = raw_field('#myint', -999);
Regarding searching, you can distinguish between the two by looking for 'true' or 'false' as in
Code:
#myint:true

Last edited by chaley; 03-06-2021 at 06:04 PM.
chaley is offline   Reply With Quote