View Single Post
Old 07-07-2021, 04:16 PM   #605
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,110
Karma: 77213681
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by Hortensia View Post
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

Last edited by ownedbycats; 07-07-2021 at 04:21 PM.
ownedbycats is offline   Reply With Quote