View Single Post
Old 02-06-2023, 10:12 AM   #8006
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: 11,155
Karma: 77304081
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by JimmXinu View Post
I didn't really think about it before, but if it were me doing this, I'd probably implement it with a Calibre 'built from other columns' custom column that is just a display for the existing exact word count column.
I use this for displaying floating-point purchase cost in the tag browser. It can be easily changed to use integer wordcount.

EDIT: Note switch_if is a relatively new function, two or three versions ago. If you're using an older version may not be present.

Code:
program:
	switch_if(
		$$#purchasecost == 'none', '',
		$$#purchasecost ==# '00.00', '$0.00',
		$$#purchasecost <=# '00.99', '$0.01 - $0.99',
		$$#purchasecost <=# '04.99', '$1.00 - $4.99',
		$$#purchasecost <=# '10.00', '$5.00 - $9.99',
		$$#purchasecost <=# '15.00', '$10.00 - $14.99',
		$$#purchasecost <=# '15.00', '$10.00 - $14.99',
		$$#purchasecost <=# '20.00', '$15.00 - $19.99',
		$$#purchasecost <=# '30.00', '$20.00 - $29.99',
		'$30.00 and up' 
	)

Last edited by ownedbycats; 02-06-2023 at 10:16 AM.
ownedbycats is offline   Reply With Quote