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 09-27-2016, 10:55 PM   #1
kaufman
Calibre Companion Fanatic
kaufman ought to be getting tired of karma fortunes by now.kaufman ought to be getting tired of karma fortunes by now.kaufman ought to be getting tired of karma fortunes by now.kaufman ought to be getting tired of karma fortunes by now.kaufman ought to be getting tired of karma fortunes by now.kaufman ought to be getting tired of karma fortunes by now.kaufman ought to be getting tired of karma fortunes by now.kaufman ought to be getting tired of karma fortunes by now.kaufman ought to be getting tired of karma fortunes by now.kaufman ought to be getting tired of karma fortunes by now.kaufman ought to be getting tired of karma fortunes by now.
 
kaufman's Avatar
 
Posts: 873
Karma: 1088610
Join Date: Nov 2006
Device: Galaxy Note 4, Kindle Voyage
Having trouble creating a custom column

I'm trying to create a custom column that shows the series name if it exists, one of two tags if they exist, or "other". I have created this:

program:
first_non_empty(
field(‘series’),
str_in_list( field('tags'),",", "_Next","Next", ""),
str_in_list( field('tags'),",", "_Soon","Soon", ""),
str_in_list( field('tags'),",", "_Favorites","Favorites",""),
"Other"
)

If I take out the series line and the other line it works. If I include those lines I get a template error.

Any help would be appreciated. Thanks.
kaufman is offline   Reply With Quote
Old 09-28-2016, 03:49 AM   #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: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kaufman View Post
I'm trying to create a custom column that shows the series name if it exists, one of two tags if they exist, or "other". I have created this:

program:
first_non_empty(
field(‘series’),
str_in_list( field('tags'),",", "_Next","Next", ""),
str_in_list( field('tags'),",", "_Soon","Soon", ""),
str_in_list( field('tags'),",", "_Favorites","Favorites",""),
"Other"
)

If I take out the series line and the other line it works. If I include those lines I get a template error.

Any help would be appreciated. Thanks.
The "series" line is using forward and backward apostrophes. They should both be straight.

The template will run faster if you fetch the tags once, as in
Code:
program:
	t = field('tags');
	first_non_empty(
		field('series'),
		str_in_list(t, ",",	"_Next","Next",	""),
		str_in_list(t, ",",	"_Soon","Soon",	""),	
		str_in_list(t, ",",	"_Favorites","Favorites",""), 
               "Other"
	)
chaley is offline   Reply With Quote
Advert
Old 09-28-2016, 12:05 PM   #3
kaufman
Calibre Companion Fanatic
kaufman ought to be getting tired of karma fortunes by now.kaufman ought to be getting tired of karma fortunes by now.kaufman ought to be getting tired of karma fortunes by now.kaufman ought to be getting tired of karma fortunes by now.kaufman ought to be getting tired of karma fortunes by now.kaufman ought to be getting tired of karma fortunes by now.kaufman ought to be getting tired of karma fortunes by now.kaufman ought to be getting tired of karma fortunes by now.kaufman ought to be getting tired of karma fortunes by now.kaufman ought to be getting tired of karma fortunes by now.kaufman ought to be getting tired of karma fortunes by now.
 
kaufman's Avatar
 
Posts: 873
Karma: 1088610
Join Date: Nov 2006
Device: Galaxy Note 4, Kindle Voyage
Thanks very much. I can always count on you.
kaufman is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pls help with creating a custom column Mamaijee Library Management 12 09-26-2016 10:01 PM
Sony book sorting by author fails when creating collections from a custom column speakingtohe Devices 2 05-15-2014 01:27 PM
Help creating custom column apesmom Calibre 2 04-03-2014 11:30 AM
Creating Custom Column for Read and Date Read library addict Calibre Companion 11 03-22-2014 05:33 AM
Creating a Custom Column Link a_daley Library Management 5 02-16-2014 05:56 AM


All times are GMT -4. The time now is 11:25 AM.


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