Oh, my fault...
This one should work like you want
Code:
program:
contains(ifempty(field('series'),'-'),'-',template('{authors} - {title}'),template('{authors} {series:|(| }{series_index:0>5.2f|#|)} {title}'));
Remark:
Its working in program mode.
I check for series and give back series or '-' if there is no series.
contains check for '-' and use then one of the two template structures.
Not elegant but works.
Edit: Forgot to mention that you need to copy the complete string (both lines) in your template. You can do this direct or via the template editor