Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 03-06-2021, 05:20 PM   #1
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,829
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Unset vs Undefined

For a column icon rule/saved search, is there any way to differentiate between an integer column value that has been deliberately set as "undefined" from one that has not been set at all?

I want to show an icon/make a search for books missing a value in #chaptercount, but a lot of books don't really have traditional chapters.

I thought about just putting '0' in for those books, but that would appear in the book details and break the math if I want to divide pagecount by chaptercount or something.


Last edited by ownedbycats; 03-06-2021 at 05:49 PM.
ownedbycats is online now   Reply With Quote
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,375
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
Advert
Old 03-07-2021, 06:23 AM   #3
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,375
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Actually, for rules you don't need the GPM template. You can instead use a double condition, one checking that the value is set and the other checking the actual value.
Attached Thumbnails
Click image for larger version

Name:	Clipboard01.jpg
Views:	84
Size:	63.4 KB
ID:	185794  
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting and undefined values ownedbycats Library Management 3 07-22-2020 01:32 PM
Removal of undefined classes from text mcdummy Editor 16 07-08-2020 07:45 AM
Is there way to list undefined classes? phossler Editor 10 07-29-2018 09:33 PM
W3C Validation says: Elements are undefined verydeepwater ePub 7 01-11-2013 05:09 AM
PRS-600 Sony library - Error undefined omk3 Sony Reader 13 01-22-2010 10:52 AM


All times are GMT -4. The time now is 12:40 PM.


MobileRead.com is a privately owned, operated and funded community.