INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: IsEmpty() behavior  (Read 669 times)

sbdallas

  • Regular Member
  • Junior Woodchuck
  • **
  • Posts: 74
  • My only friend is a goat.
IsEmpty() behavior
« 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.
Logged
Scott

I finally stopped drinking for good.
Now I drink for Evil.

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4580
Re: IsEmpty() behavior
« Reply #1 on: November 12, 2021, 09:25:00 am »

First quick idea. what when you use [Album Attribute,0] instead of [Album Attribute]

 :)
gab
Logged

sbdallas

  • Regular Member
  • Junior Woodchuck
  • **
  • Posts: 74
  • My only friend is a goat.
Re: IsEmpty() behavior
« Reply #2 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.
Logged
Scott

I finally stopped drinking for good.
Now I drink for Evil.

sbdallas

  • Regular Member
  • Junior Woodchuck
  • **
  • Posts: 74
  • My only friend is a goat.
Re: IsEmpty() behavior
« Reply #3 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.
Logged
Scott

I finally stopped drinking for good.
Now I drink for Evil.

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42373
  • Shoes gone again!
Re: IsEmpty() behavior
« Reply #4 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.
Logged
Matt Ashland, JRiver Media Center

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: IsEmpty() behavior
« Reply #5 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.

Pages: [1]   Go Up