View Single Post
Old 12-28-2021, 05:26 AM   #262
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 ownedbycats View Post
Also, unrelated to the above error:

Is it possible to put a strcat inside a first_non_empty? For icon_fanfics shared template, I want to display multiple icons, but if none exist then use a placeholder. This gave me an error:

Code:
program:

first_non_empty(
   strcat
   (
		if "^foo$" inlist $#taglike then 'foo.png:' fi,		
		if "^bar$" inlist $#taglike then 'bar.png:' fi,
		if "^foobar$" inlist $#taglike then 'foobar.png:' fi,
   )
   if $#taglike then 'placeholder.png' fi 
)
I considered a list_difference (I use one for icons_formats) but I have close to 50 entries!

EDIT: I found a very weird workaround that maybe only works because it's a shared template. I put this in column rules/emblems:

Code:
program:

		if icons_fanfic() then icons_fanfic() 
		else 'placeholder.png' fi
Yes, you can use strcat in a first_non_empty. However, you need to be careful about where you put commas. Your template should be
Code:
program:

first_non_empty(
   strcat
   (
		if "^foo$" inlist $#taglike then 'foo.png:' fi,		
		if "^bar$" inlist $#taglike then 'bar.png:' fi,
		if "^foobar$" inlist $#taglike then 'foobar.png:' fi
   ),
   if $#taglike then 'placeholder.png' fi 
)
I removed the comma at the end of line 6 (the foobar line) and added one on line 7 (the ')' line).
chaley is offline   Reply With Quote