Thanks for your help, I like it clear and efficient

I have (I hope) a last improvement to do :
I need to make a custom field (#kobocollections), which content is feed by another custom field if not empty (#categorieperso), and a custom value if empty ({authors:sublist(0,1,&)}{series:| - |}).
I succeeded by using :
Code:
program:
a = field('#categorieperso');
b = template('{authors:sublist(0,1,&)}{series:| - |}');
test(field('#categorieperso'), a, b)
But can you explain to me why with this :
Code:
{#categorieperso:'ifempty($, template('{authors:sublist(0,1,&)}{series:| - |}'))'}
I get a template error formatter when my serie own a " ' " ??
Can you help me again, please ??