Quote:
Originally Posted by capink
On a second thought, wouldn't a defined_book_vars() that returns a list of defined vars for book cover more ground? We can test for the above using:
Code:
str_in_list(defined_book_vars(), ',', 'var_name', 1, '')
|
Not sure.
On the plus side: in addition to checking for individual book vars, your suggestion has the advantage of being able to ask about more than one variable at once, as in
Code:
list_contains(defined_book_vars(), ',', '^(var_name1|var_name2)$', 1, '')
or check for prefixes
Code:
list_contains(defined_book_vars(), ',', '^var_name.*$', 1, '')
However, it is a bit more complicated to use in the simple case.
I think I lean in the same direction you do: the generality is better. And anyway, if someone really wants to use the original suggestion then they can do it with a stored template.
Code:
program:
arguments(var_name);
if str_in_list(defined_book_vars(), ',', 'var_name', 1, '') then
'1'
else
''
fi
PS: I am thinking about adding "return" to the template language, which would allow the above template to be written
Code:
program:
arguments(var_name);
if str_in_list(defined_book_vars(), ',', 'var_name', 1, '') then
return('1')
else
return('')
fi