View Single Post
Old 05-10-2022, 02:07 AM   #397
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,170
Karma: 77304081
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Question:

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;


	if 
		mobi == amazon
	then
		ids = list_difference(ids, strcat('mobi-asin:', mobi), ',')
	else
		ids
	fi
I have two books. Book #1 has only the mobi-asin identifier, while Book #2 has identical mobi-asin and amazon ids.

The results are this:

Click image for larger version

Name:	2022-05-10 03_11_37-Template tester.png
Views:	988
Size:	50.2 KB
ID:	193744

Aside from either separating the two parts into separate templates or running it twice, is there any way to tell it "do part A (copy mobi-asin to amazon), and then also do part B (remove mobi-asin)"?

EDIT: See my post in the while loop thread.

Last edited by ownedbycats; 05-10-2022 at 03:12 AM.
ownedbycats is offline   Reply With Quote