View Single Post
Old 01-02-2022, 08:36 PM   #4
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by HunterRose View Post
I am trying to update my custom book list template to show if a book has the Completed tag or not.

{tags} works fine, but I'm not interested in seeing the whole string, especially as it make take multiple lines.

I have tried

Code:
{str_in_list(field('tags'),',','Completed','Incomplete')}
That looks like you are trying to search for the tag "Completed" and return something. There are two problems. Firstly, the structure of the call is incorrect. The other is that you are missing a parameter. The "str_in_list" requires at least five parameters. The list to check, the divider to use, the item to search for, the result to return when it is found, and the result to return when it is not found.

What you probably want is:

Code:
{:str_in_list(field('tags'), ',' ,'Completed', 'Complete', 'Incomplete')}
But, as you mention adding "program:", I would use:

Code:
program:
str_in_list(field('tags'), ',' ,'Completed', 'Complete', 'Incomplete')
Quote:
and

Code:
{contains(field('tags'),'Completed','Completed','Incomplete')}
and nothing is appearing in the generated output. I have also inserted 'program:' inside the first bracket with the same non-results.
There is a similar issue with that one. I would use something like:

Code:
program:
contains(field('tags'), 'Completed', 'Completed', 'Incomplete')
But, I would use the first "str_in_list" as to me that is more obvious as to it's intention.
davidfor is offline   Reply With Quote