INTERACT FORUM

More => Old Versions => JRiver Media Center 28 for Windows => Topic started by: sbdallas on November 12, 2021, 09:22:10 am

Title: IsEmpty() behavior
Post by: sbdallas on November 12, 2021, 09:22:10 am
I'm having an issue with the IsEmpty() function.  I created a custom field called Album Attribute which I want to build into the file name if and only if it has a value.  Album Attribute is a string field.

If(!IsEmpty([Album Attribute], 0),T,F) always returns T.

If(!IsEmpty([Album Attribute], 0),/ /([Album Attribute]/), zoink) returns (X) if [Album Attribute] = X and if empty it returns (Unknown Album Attribute).

My guess is that I somehow set up the custom field incorrectly, but it is such a simple thing to do, I'm not sure how I could have muffed it.  I would appreciate any ideas.
Title: Re: IsEmpty() behavior
Post by: gappie on November 12, 2021, 09:25:00 am
First quick idea. what when you use [Album Attribute,0] instead of [Album Attribute]

 :)
gab
Title: Re: IsEmpty() behavior
Post by: sbdallas on November 12, 2021, 09:44:54 am
I was unaware of that syntax, so THANK YOU!

However, it does not solve the problem.  I am using [Album Attribute] to store strings like "Remastered" or "Remixed".  The goal is to produce the following...

Back In Black (Remastered) if the [Album Attribute] is filled or
Back in Black if [Album Attribute] is empty.
Title: Re: IsEmpty() behavior
Post by: sbdallas on November 12, 2021, 11:35:11 am
I think I have figured this out.  There appears to be a flaw in the logic when renaming files.

If I use this...
    If(IsEmpty([Genre]),T,F)
...in a rename rule, then you get F every time regardless of whether Genre is empty or full.

If I create a new calculated field which contains the EXACT SAME CODE then use that field name in the rename rule, then you get the correct value.  I can therefore state that I believe IsEmpty() to be broken when used in a rename rule, but working from within a calculated field.
Title: Re: IsEmpty() behavior
Post by: Matt on November 12, 2021, 12:06:00 pm
Try this:
If(IsEmpty([Genre, 0]),T,F)

Otherwise the genre can get filled with a friendly display name.
Title: Re: IsEmpty() behavior
Post by: marko on November 12, 2021, 12:58:42 pm
Here's an old post with an explanation...
https://yabb.jriver.com/interact/index.php/topic,113853.msg786923.html#msg786923

Also, is the use of the exclamation mark in your posted expressions intentional? I haven't tested, but that could well be inverting your results, so positives become negatives.

This should really be added to the IsEmpty() wiki entry. I'll add it to my list and get to it before the year end.

-marko.