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
For example two books running in the template function editor gives the following values
Code:
true ->Science Fiction<-
true ->Heftserie, Western<-
But there is something wrong in my code because it returns always true.
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
Same behavior, next try with
Code:
program:
_is_in = list_contains(field('tags'), ',', 'Western',1,0);
shows
for the example above. Fine, but if I try to test the variable
Code:
program:
_is_in = list_contains(field('tags'), ',', 'Western',1,0);
if _is_in = 1 then 'true' else 'false' fi
or with
Code:
program:
_is_in = list_contains(field('tags'), ',', 'Western',1,0);
if _is_in then 'true' else 'false' fi
you get
for the example above.
Seems to be on a wrong way - someone can help?
Using Calibre 7.26.0 on Win 11 Pro