View Single Post
Old 05-27-2013, 01:13 PM   #186
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
Posts: 13,572
Karma: 79436804
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
Actually, I've just tried and all of that can be done with a single custom column.

Add a custom column with Lookup Name shelfname and Column Heading Shelf Name of type Column built from other columns
Set it's template to
Code:
Code:
{#myshelves:'ifempty($, ifempty(field('Series'), 'Uncategorized'))'}
Restart Calibre

Change the shelf options in the Kobo Driver to simply #shelfname and all should be done.

This is basically the same as before, but all in a single definition.

Code:
Basically, if myshelves is non empty,
   #myshelves:'ifempty($
   return the value of myshelves, 
else if Series is non empty, 
   ifempty(field('Series')
   return the value of Series, 
else 
   'Uncategorized'
   return the word Uncategorized
=====

Even EASIER

As above but make the program
Code:
{:'first_non_empty(field('#myshelves'), field('Series'), 'Uncategorized')'}
This will simply return the first non empty argument from the list! So if myshelves has a value, that is used. If it didn't then Series is used, and if THAT was blank then 'Uncategorized' is used!

Last edited by PeterT; 05-27-2013 at 01:19 PM.
PeterT is offline