View Single Post
Old 10-05-2022, 02:55 AM   #935
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,495
Karma: 8065348
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by trxplz0 View Post
Hi,

Can someone help me with this save template code?

I'm not finding a way to do a OR between the strings. I did try to use first_non_empty function, but it sees the function as text and not “code”.

Here's what I have so far:

{series[0]} OR {title[0]}/{series} OR {title}/{series_index:0>3s|| - }{series} OR EMPTY - {title}/{pubdate} - {title}

This is what I'm trying to achieve:

E.g.: #1 Serie: A Song Of Ice and Fire, Serie Index: 3, Title: A Clash of Kings, Date: 2021

📂A
---- 📂 A Song Of Ice and Fire
-------- 📂 003 - A Clash of Kings
------------ 📂 2021 - A Clash of Kings

E.g.: #2 Serie: , Serie Index: , Title: Calibre is the best, Date: 2022

📂C
---- 📂 Calibre is the best
-------- 📂 2022 - Calibre is the best
I don't understand what your sequence of OR's is supposed to do. Series is either set or not set, but it appears in several of the OR'ed expressions. Title is always set but the OR's seem to account for it being empty. What selects which expression?

Going from your examples, this template produces the given answer
Code:
program:
	if $series then
		template('{series[0]}/{series}/{series_index:0>3s|| - } {title}/{pubdate:|| - }{title}')
	else
		template('{title[0]}/{title}/{pubdate:|| - }{title}')
	fi
chaley is offline   Reply With Quote