View Single Post
Old 05-24-2019, 05:47 PM   #1
wishingstar
Enthusiast
wishingstar can extract oil from cheesewishingstar can extract oil from cheesewishingstar can extract oil from cheesewishingstar can extract oil from cheesewishingstar can extract oil from cheesewishingstar can extract oil from cheesewishingstar can extract oil from cheesewishingstar can extract oil from cheese
 
Posts: 33
Karma: 1032
Join Date: Nov 2016
Device: Kobo Aura Edition 2, Lenovo Android 10
Question Adding logic to send to device template

Hi all!

I've been using a template to send books to my Android tablet, Chaley helped me refine it in a previous thread back in 2016. I want to add more refinement to the template to further sort books on my device. Here's the current template:

Code:
program:
	ta = test(field('series'), strcat(field('series'),'/',field('#serind'),' - ',field('#firstauth'),' - ',field('title')), strcat(field('#firstauth'),' - ',field('title')));
	str_in_list(field('tags'), ',', 'Fiction', 
		strcat('eBooks/Fiction/', ta), 
		strcat('eBooks/Non-Fiction/', ta))))
So, the way I understand this code, str_in_list creates an if-else condition, if true the book goes to the fiction folder, else it goes to non-fiction. Now what if I want to separate thrillers from sci-fi/fantasy? Basically what I want is:

If fiction
If Sci-Fi OR Fantasy
put in sci-fi fantasy folder
else
put in thriller folder
else
put in non-fiction folder


I understand that this will be a nesting of str_in_list commands, but my question is regarding the OR in the second if statement, how do I do OR in Calibre?

Code:
str_in_list(field('tags'), ',', 'Sci-Fi', {OR} 'Fantasy'
Thanks!
wishingstar is offline   Reply With Quote