View Single Post
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: 12,476
Karma: 8025702
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