01-02-2022, 03:10 PM | #1 |
Junior Member
Posts: 4
Karma: 10
Join Date: Jan 2022
Device: iPad
|
Book list template question
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')} Code:
{contains(field('tags'),'Completed','Completed','Incomplete')} What nuance am I missing here? Last edited by BetterRed; 01-02-2022 at 08:07 PM. |
01-02-2022, 03:11 PM | #2 |
Junior Member
Posts: 4
Karma: 10
Join Date: Jan 2022
Device: iPad
|
P.S. Hey, the word 'Incomplete' does not have spaces in it in either instance that I typed, but the forum software apparently knows better.
|
Advert | |
|
01-02-2022, 08:09 PM | #3 |
null operator (he/him)
Posts: 20,777
Karma: 27405072
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
|
01-02-2022, 08:36 PM | #4 | ||
Grand Sorcerer
Posts: 24,905
Karma: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
What you probably want is: Code:
{:str_in_list(field('tags'), ',' ,'Completed', 'Complete', 'Incomplete')} Code:
program: str_in_list(field('tags'), ',' ,'Completed', 'Complete', 'Incomplete') Quote:
Code:
program: contains(field('tags'), 'Completed', 'Completed', 'Incomplete') |
||
01-02-2022, 09:37 PM | #5 |
Junior Member
Posts: 4
Karma: 10
Join Date: Jan 2022
Device: iPad
|
davidfor, thank you for your assistance, I am trying out your suggestions.
(It appears that my original post was edited to improve formatting and one of the 'Completed's was dropped along the way.) |
Advert | |
|
01-02-2022, 10:39 PM | #6 |
Junior Member
Posts: 4
Karma: 10
Join Date: Jan 2022
Device: iPad
|
(Partially) Solved!
OK, my major difficulty was trying to place the formula in the book list template itself - checking one of the 'related' threads reveals that the book list template does not evaluate expressions.
The solution is to create a custom column that evaluates to the desired value and putting the name of the column in the book list template: #status column contains template Code:
{tags:in_list($,', ',Completed,Complete,Incomplete)} Code:
{#status} |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Custom list template | Laval | Related Tools | 6 | 10-11-2022 09:13 AM |
Conditional statements or scripting in "Book list template" ? | Boilerplate4U | Calibre | 4 | 08-30-2021 11:53 PM |
Template: Matching an entire list | ownedbycats | Library Management | 20 | 05-09-2021 11:08 PM |
Book List question | Grenpa | Kobo Reader | 4 | 12-19-2014 08:21 PM |
Create a template to only list one author. | PMGeuze | Calibre | 2 | 12-04-2013 02:53 PM |