View Single Post
Old 05-10-2022, 05:10 AM   #401
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,509
Karma: 8065348
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
I figured it out! I added two lines between the clauses, and it updated the variables. I suppose this might be a case where using variables as a typing shortcut wasn't a good idea.

Code:
program:
	ids = $identifiers;
	mobi = select(ids, 'mobi-asin');
	amazon = select(ids, 'amazon');

	if 
		mobi && !amazon
	then 
		n = re(mobi, '(.*)', '\1');
		ids = list_union(ids, strcat('amazon:', n), ',')
	else
		ids
	fi;

	mobi = select(ids, 'mobi-asin');
	amazon = select(ids, 'amazon');

	if 
		mobi == amazon
	then
		ids = list_difference(ids, strcat('mobi-asin:', mobi), ',')
	else
		ids
	fi
Instead of redoing the select you could add after the list_union() line
Code:
amazon = mobi
chaley is offline   Reply With Quote