![]() |
#1 |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Mar 2025
Location: Germany
Device: Tolino Shine
|
Problem with template function
Hi,
I want to decide how to construct the filename depending on a tag entry. Simple code for testing the tags... Code:
program: if list_contains(field('tags'), ',', 'Western') then strcat('true ->' , field('tags'), '<-') else strcat('false ->' , field('tags'), '<-') fi Code:
true ->Science Fiction<- true ->Heftserie, Western<- So I tried some other code. Code:
program: if list_contains(field('tags'), ',', 'Western',1,0) then strcat('true ->' , field('tags'), '<-') else strcat('false ->' , field('tags'), '<-') fi Code:
program: _is_in = list_contains(field('tags'), ',', 'Western',1,0); Code:
1 0 Code:
program: _is_in = list_contains(field('tags'), ',', 'Western',1,0); if _is_in = 1 then 'true' else 'false' fi Code:
program: _is_in = list_contains(field('tags'), ',', 'Western',1,0); if _is_in then 'true' else 'false' fi Code:
1 1 Seems to be on a wrong way - someone can help? Using Calibre 7.26.0 on Win 11 Pro |
![]() |
![]() |
![]() |
#2 |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Mar 2025
Location: Germany
Device: Tolino Shine
|
Solved... == is better than =
![]() |
![]() |
![]() |
Advert | |
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Changes to template function documentation processing | chaley | Library Management | 6 | 11-24-2024 07:36 AM |
BuiltinAdd template language function | DyckBook | Editor | 4 | 10-19-2021 04:21 PM |
Using built-in template functions in a custom template function | ilovejedd | Library Management | 4 | 01-28-2018 12:20 PM |
Problem with contains function in save template | MicaOlaAdams | Calibre | 5 | 10-21-2016 10:25 AM |