Quote:
Originally Posted by myki
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)
|
FWIW: you could use
Code:
program:
a = field('#categorieperso');
b = template('{authors:sublist(0,1,&)}{series:| - |}');
ifempty(a, b)
or
Code:
program:
ifempty(
field('#enum2'),
template('{authors:sublist(0,1,&)}{series:| - |}'))
Quote:
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 ??
|
You cannot put { or } characters in a
template program mode template. The substitutions indicated by the {} characters happen before the template program fragment is evaluated, confusing the template evaluator. In your case the apostrophe is being interpreted as a string delimiter, creating a syntax error. You must use
general program mode when you wish to evaluate sub-templates.