View Single Post
Old 04-30-2023, 06:23 PM   #607
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,529
Karma: 8075938
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by dunhill View Post
I have modified the template to my options
program:

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

ids = do_one($identifiers, "Amazon",'amazon');
ids = do_one(ids, "Cuspide", 'cuspide');
ids = do_one(ids, "Yenny", 'yenny');
ids = do_one(ids, "Baen", 'baen')

I have a column #libreria is the store where I buy the book
Usually Yenny
and in the identifiers cargo yenny:9789504968566

what I wanted is if in the store field it is Yenny just see the isbn of yenny
That template is incorrect. It uses a variable named 'if', which is a keyword. Here is a corrected version of the template. (Please use code tags for templates!)
Code:
program:
	def do_one(ids, check_value, select_identifier):
		sel = select(ids, select_identifier);
		if
			!$#libreria==check_value && sel
		then
			return list_difference(ids, strcat(select_identifier, sel), ',')
		fi;
		return ids
	fed;
	
	ids = do_one($identifiers, "Amazon",'amazon');
	ids = do_one(ids, "Cuspide", 'cuspide');
	ids = do_one(ids, "Yenny", 'yenny');
	ids = do_one(ids, "Baen", 'baen')
That said, I don't understand what this template is supposed to do. The function do_one() seems to do nothing if the check_value (the second parameter) equals the contents of #libreria. Said another way, it removes any identifier where the id name == the third parameter (select_identifier) and the store ($#libreria) does not equal to the second parameter (check_value). For example, the third call to do_one() does nothing if #libreria equals 'yenny', which from your text isn't what you want.

Sorry, but the complexity here is higher than I can cope with.
chaley is offline   Reply With Quote