View Single Post
Old 08-14-2023, 08:09 AM   #2
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,466
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by imnnrv View Post
My non-fiction collection consist mostly of 1-2 books of each author and i would like export these books into one directory, except rare cases when i have many books of this author.
Is there any way to make export template which creates directory .../category/author for author only if there are more than X books of this author? If there less than X his books, then put them into .../category/
You don't say what "category" is or what to do with multiple authors. I used 'tags' for category, which is probably wrong.

Customize this template to give the answer you want. I used the 'template()' function because that might be easier for you. If I was doing this for me then I would construct the results myself.
Code:
program:
	first_author = list_item($authors, 0, '&');
	books_by_author = book_count('authors:"""=' & first_author & '"""', 0);
	X = 2;
	if books_by_author < X then
		answer = template('{tags}')
	else
		answer = template('{tags}/{authors:list_item(0,&)}')
	fi;
	answer
chaley is offline   Reply With Quote