View Single Post
Old 01-07-2023, 04:29 PM   #2
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,453
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by jwahome2002 View Post
Hello - very new to Calibre, but very familiar with data manipulation. I am trying to create a custom field using if-then-else. I have spent days searching and cannot figure out the correct syntax.

Here is what I am trying to solve for:

IF {universe} isempty

THEN concatenate({universe},{book#})

ELSE concatenate ("1",{author},{saga},{Book#}


Any help is greatly appreciated!!
You didn't give the real column lookup names so I am guessing. And what you wrote doesn't make a lot of sense. For example, why are you concatenating an empty field (universe) with book#? And what is book#?

Assuming you meant not isempty on the IF, that "universe" is a custom column with the lookup key #universe, that "saga" is a custom column with the lookup name #saga, and "book#" is the calibre book id, I think you want something like this in General Program Mode:
Code:
program:
	if $#universe then
		strcat($#universe, $id)
	else
		strcat('1', $authors, $#saga, $id)
	fi
chaley is offline   Reply With Quote