Quote:
Originally Posted by Hortensia
I do not use this plugin but I will have a look at the template language. I test and I will let you know.
|
Here's some to show you what's possible to be done.
I have a template single-field edit that checks for specific values in some custom columns and then adds values to my Kobo collection column based on them:
Code:
program:
g = field('#genres');
vl = field('#vls');
k = field('#kobocoll');
v = first_non_empty(
list_contains(vl, ',', '^Loans$', 'Loans', ''),
list_contains(g, ',', '^Fanfiction$', 'Fanfiction', ''),
list_contains(g, ',', '^Horses$', 'Horses', ''),
list_contains(g, ',', '^Cozy Mystery$', 'Cozy Mysteries', ''),
list_contains(g, ',', '^(Fantasy|Science Fiction)$', 'Fantasy & Sci-Fi', ''),
);
list_union(k, v, ',')
I have another that checks fanfics marked as 'in-progress' and sets them to 'abandoned' if they haven't been updated in a few years or have an error:
Code:
program:
d1 = format_date(today(),'iso');
d2 = $$#fanficupdated;
status = $#fanficstatus;
if
and(
status=='In-Progress',
days_between(d1, d2) ># 730,
)
then
"Abandoned"
elif
and(
status=='In-Progress',
$#fanficerror,
)
then
"Abandoned"
else
status
fi