View Single Post
Old 06-02-2020, 04:46 AM   #872
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 Penny_Dreadful View Post
Hello, I'm looking for some help creating a composite column combined with an advanced icon rule, to give me a column that has icons for the online libraries I can borrow that book from. I currently have columns for each of theses online libraries but I'm hoping to combine the columns into one.

The Calibre Library is my Wish-list/To Read Library so its full of empty books with full metadata. The ID field might have ids for "borrowbox", "wheelers" and "odid" which is a combined ID that might have Overdrive ID and/or a Kindle Unlimited ID. It might also not have any of those IDs in which case I'd like nothing to show in that column.

The IDs look like this:
borrowbox:AAU_779614 Three uppercase letters then an underscore then six numbers ^[A-Z]{3}_\d{6}$ is the regex I am using for the single column
wheelers:9781760873752 Yes this is the ISBN 13 of the book ^(?=(?:\D*\d){10}(??:\D*\d){3})?$)[\d-]+$ ISBN regex.

and the odid can look like one of these:
odid:5426939@wapldmc.overdrive.com
odid:B088PB8T42@ak/unlimited
odid:2077018@wapldmc.overdrive.com&B00PY6CSNM@ak/unlimited

and my icons are named kunlimited.png, wheelers.png, borrowbox.png and overdrive.png

Thanks for any help!

I've created the column listing the IDs by using the template:
program:
strcat(select(field('identifiers'),'odid'),' ', select(field('identifiers'),'borrowbox'),' ', select(field('identifiers'),'wheelers'));

but getting the icons to work using an advanced rule is just confusing me.
The result of the advanced icon rule has to be the name of the icon to use. I can't work out how to return multiple icons in one advance rule, so, you need one rule per icon that could be displayed. If you could have only one source for each book, we could create a rule that returned a single icon name.

The following advanced rule should work to give the icon for Overdrive:

Code:
program:
id = select(field('identifiers'),'odid');
contains(id, 'overdrive', 'overdrive.png','')
And for Amazon Unlimited
Code:
program:
id = select(field('identifiers'),'odid');
contains(id, 'unlimited', 'kunlimited.png','')
Add each of the above as separate advanced rules with the "Kind" of either "composed icons w/text" or "composed icons w/no text". That will allow multiple icons to be shown in a single column.

For "Borrowbox" and "Wheelers", the value of the identifier shouldn't matter, just that the identifier exists. And you can use simple icon rules. The first field needs to be set to either "composed icons w/text" or "composed icons w/no text". The condition is "If the Identifiers column has id value: wheelers". And then do a similar rule for "Borrowbox".
davidfor is offline   Reply With Quote