Quote:
Originally Posted by ownedbycats
Question: How would I set up a template for single-field edit to add an entry to a tag-like?
I have a tag-like #kobocoll for Kobo collections. I'd like to add certain entries depending on the presence of certain entries in #genre column - e.g. if "fantasy" or "science fiction" are present, add "Fantasy & Sci-Fi" to #kobocoll.
thank you!
|
It would be something along those lines ...
Code:
program:
genre = field('#genre');
kobocoll = field('#kobocoll');
intersection = list_intersection(genre, 'fantasy,science-fiction', ',');
if intersection == '' then
kobocoll
else
strcat(kobocoll, ',Fantasy & Sci-Fi')
fi
Edit: The template processor in single field edit has been modified to do the following:
- If the template returns a value identical to the current value, it will be discarded and no change will happen.
- If the template returns an empty string, the plugin will unset the column value. This includes all data types (text, numerals, dates ... etc)