View Single Post
Old 05-07-2023, 11:16 AM   #615
dunhill
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 896
Karma: 810834
Join Date: Sep 2017
Location: Buenos Aires, Argentina
Device: moon+ reader, kindle paperwhite
Quote:
Originally Posted by chaley View Post
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.

As I said before, I wanted to modify the ownbycats template

But I tell you what I have.
I have a custom identifier yenny and cuspide:

And a library column (which is where I bought the book from) Yenny, Cúspide, Amazon

I would like to have the identifier number in another column depending on the Library column.

If in the library column it says Yenny In another column it would have to show me only the identifier of yenny

If in the library column it says Cúspide In another column it would have to show me only the identifier of cuspide

If in the library column it says Amazon In another column it would have to show me only the amazon identifier

I thought that essentially what the ownbycats template did could help me, if you can guide me in this regard, I would be very grateful

Last edited by dunhill; 05-07-2023 at 11:19 AM.
dunhill is offline   Reply With Quote