View Single Post
Old 11-05-2020, 02:16 PM   #898
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,354
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Code:
program:
	p = identifier_in_field(id:isbn)
	g = identifier_in_field(id:goodreads)

  if p then strcat(p)
  else 
  if g then strcat(g)
 fi
I was trying to make it show Goodreads only if the ISBN didn't exist. It didn't quite work as expected.

Attachment 183232

I'm still trying to figure these out.
There are several errors in this template.
  • You need semicolons between the statements.
  • There is no function identifier_in_field. I think you mean identifier_in_list, but regardless you don't want to use it. Instead use 'select'.
  • You are missing a second fi (as Terisa de morgan said
That said, if I understand what you want to do then this template is does the job.
Code:
program:
	i = field('identifiers');
	ifempty(select(i, 'isbn'), select(i, 'goodreads'))
If you really want to use an if statement then this works.
Code:
program:
	i = field('identifiers');
	p = select(i, 'isbn');
	if p then p else select(i, 'goodreads') fi
chaley is offline   Reply With Quote