More > JRiver Media Center 24 for Mac

Trouble with isempty formula

(1/2) > >>

Sangie:
I'm trying to only make a folder for Album if the image file (I'm sorting images) has an album. All images have an artist associated.

So if an image has an album, it will be /Genre/Artist Name/Album Name/file name.ext
If no album, the path will be /Genre/Artist Name/file name.ext

Here is the formula I'm using.

--- Code: ---[Genre]/[Artist]/if(isempty([Album],1),,[Album])
--- End code ---
Where did I screw up?

RoderickGI:
You are doing a numerical test in the isempty command. [Album] is, naturally, a String. Do a string test on it.



--- Code: ---[Genre]/[Artist]/if(isempty([Album],0),,[Album])
--- End code ---

Sangie:
Thank you! I tried that though and now it says "Unknown Album" in the path. I copy pasted exactly what you put. Album is completely empty. I'm not sure what's wrong. I attached a screenshot.

marko:
The ",0" needs to be inside the field tag... Like so... [Album,0]

Why? You're asking MC to create a path to a file, and operating systems don't like/allow folders with no name, so, only when using the 'rename' tool, if a field is empty, potentially creating a nameless folder, the rename tool fills it with "Unknown field name" before handing it over to the expression evaluator, meaning that, as far as the evaluator is concerned, the field is not empty. inserting the ",0" inside the field name tells all involved to use the raw field data 'as-is', so then, empty, really means, empty :)

-marko

RoderickGI:
Hey. I answered that last night. I must have forgotten to click Post after all the Previews I did!  :(

Or I got Administratored, because I did waffle on a bit.  ;D

So yeah, the full expression is;

--- Code: ---[Genre]/[Artist]/if(isempty([Album,0],0),,[Album])
--- End code ---

Nice explanation Marko. The reference is the Fields section here Sangie: https://wiki.jriver.com/index.php/Expression_Language

Navigation

[0] Message Index

[#] Next page

Go to full version