Page 1 of 1

is there way to find a CSV File and have it return null?

Posted: 14 Jun 2020, 02:18
by DevXen
So i have an odd situation in a recent change to my movie naming script. I have a part of it that puts it in Animation or live action sub folders. and i today i added stand-up to that list. as stand-up isn't a genre i have a csv file with 1,300 standup shows listed. and each returns Stand-Up. - simple.

But the next section adds the genre. which i don't need for these movies as they will always be comedy. so i have an any{} setup for genres. (for other reasons as well.) But to exclude the genre or stand-up to be added a second time I need to check the CSV file. and if there is a match return nothing. and halt the any{} function.

{if ({(csv('C:/FileBot Settings/Movies/StandUpComedyFilms.csv').get(n+" ["+y+"]"))}) ''}, results: 'expression yields empty value'.
and just about anything else i've tried has either returned that or true or false. or the csv map and each is evaluated and added to the folder name.
I've tried to think of other ways around it. and nothing i've tried today works.

got any advice?

Thanks,
-Dev

Re: is there way to find a CSV File and have it return null?

Posted: 14 Jun 2020, 05:04
by rednoah
expression yields empty value just means your expression isn't returning anything, which seems to be what you want in some cases.


e.g. this will always error out with expression yields empty value because the entire format yields nothing:

Code: Select all

{null}

e.g. this will never error out with expression yields empty value because the entire format always yields something:

Code: Select all

A{null}

As for what value you want to return in certain circumstances, well that's completely up to your code as always:

Code: Select all

{
	def condition = true
	if (condition) {
		return 'X'
	}
	return null
}

Code: Select all

{
	def condition = false
	if (condition) {
		return 'X'
	}
	return null
}