@svda, this is possible, but only if you had no tags for your books. This is a situation I do not have for both tags and pubdate.
The example I gave use "(" by starting with a tag and ")" by ending with pubdate
You can modify it e.g. this way to have only the year in
Code:
{author_sort}/{author_sort}{series:| - |} {series_index:0>2s} - {title} {tags:| |, } {languages:||, } {:'format_date(raw_field('pubdate'),'yyyy')'|(|)}
But if you need condtional, then it is better to use the code from eschwartz.