This is probably not the cleanest way of doing it, but it seems to work.
Add a new custom column with Lookup Name
shelftopic and Column Heading
Shelf Topic of type
Column built from other columns
Set it's template to
Code:
{#myshelves:'ifempty($, field('Series'))'}
Add another custom column with Lookup Name
shelfname and Column Heading
Shelf Name of type
Column built from other columns
Set it's template to
Code:
{#shelftopic:'ifempty($,'Uncategorized')'}
Restart Calibre
Change the shelf options in the Kobo Driver to simply
#shelfname and all should be done.
The first column
shelftopic will contain either the value of
myshelves, or if there is none, the value of
Series.
The second column
shelfname will contain either the value of
shelftopic or if there is none, the word
Uncategorized