View Single Post
Old 04-11-2018, 02:51 AM   #8
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by lucone View Post
Yeah, Author collection is ok
But I want to keep series and authors separeted, so Author shelves are prefixed by "__ Author"
I think you misunderstood me, but it might depend on what firmware version you are running. As of firmware version 4.4.9298, there is a separate "Authors" list. This is a list of all the authors with the number of books by that author. It has several ways to order the list. Tapping an author displays the books for that author. With this feature, I think that adding collections for the authors is a wasted effort and just clutters the collections list.
Quote:
given that
seriesPre = series.ifempty('__ Author' + field{Author})

What I want is a collection field that fullfill this rule:
IF tag == 'ELECTRONICS':
->series = '__ Electronics'
elif tag == 'HISTORY':
->series = '__ HISTO ' + {#seriesPre}
...

Hope is more clear...
Sorry, it isn't completely clear. For one thing, I can't tell if you want a single collection name returned, or multiple. And I'm not sure if having a series overrides everything else.

But, the following will get you somewhere close to what I think you want.

Code:
program:
test(
	field('series'),
	field('series'),
	test(
		in_list(field('tags'), ',', 'Science Fiction', 'SciFi', 'Fantasy', 'isfantasy', ''),
		in_list(field('tags'), ',', 'Science Fiction', 'SciFi', 'Fantasy', 'isfantasy', 'should never happen'),
		ifempty(field('series'), strcat( '__ Author - ', field('authors')))
	)
);
That will return one collection name. This will be:
- The series name if it exists
- "SciFi" if the tags has "Science Fiction" or "isfantasy" if tags has "Fantasy".
- And "__Author - {authors}" if none of the above.

This is using tags that are in my test library rather than yours. And I haven't done anything equivalent to what you want for the tag "History". But, that is an easy addition.
davidfor is offline   Reply With Quote