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

All about user-defined episode / movie format expressions
Post Reply
DevXen
Power User
Posts: 132
Joined: 12 Oct 2014, 21:15

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

Post 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
User avatar
rednoah
The Source
Posts: 18822
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

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

Post 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
}
:idea: Please read the FAQ and How to Request Help.
Post Reply