View Single Post
Old 03-25-2023, 11:10 AM   #530
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,486
Karma: 8025704
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
If I run the same template on a book that has no #purchasesource, it removes all four of them. If no identifiers are removed, it just returns the original list.
This template should do what your template does. I haven't tried it because I didn't set up the columns and the data.

Code:
program:

	def do_one(ids, check_value, select_identifier):
		si = select($identifier, select_identifier);
		if 
			!$#purchasesource==check_value && si
		then
			return list_difference (ids, strcat(select_identifier, si), ',')
		fi;
		return $ids
	fed;

	ids = do_one($identifiers, "Amazon",'amazon');
	ids = do_one(ids, "Barnes & Noble", 'barnesnoble');
	ids = do_one(ids, "Kobo", 'kobo');
	ids = do_one(ids, "Baen", 'baen')
chaley is offline   Reply With Quote