INTERACT FORUM

Please login or register.

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

Author Topic: IsEmpty expression not matching strings?  (Read 333 times)

bspachman

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 896
IsEmpty expression not matching strings?
« on: January 18, 2024, 01:04:27 pm »

Hi All--

In an effort to get more in sync with TMDB, I defined a new library field, [Series_themovieDBorg], as a string in MC’s Library options. That will let me move articles and add years when there are multiple matches for TV series. However, in doing a bunch of file re-naming, I'm having trouble with the "IsEmpty" function.

When nothing is in my user-defined field, the following expression gives me an unexpected result:
Code: [Select]
If(IsEmpty([Series_themovieDBorg]),[Series],[Series_themovieDBorg])\gives me: <basePath>\Unknown Series_themovieDBorg\
when I expect: <basePath>\[Series]\

When I revise the expression to include an argument for the IsEmpty check…
Code: [Select]
If(IsEmpty([Series_themovieDBorg],1),[Series],[Series_themovieDBorg])\gives me: <basePath>\[Series]\
which is strange, since the ‘1’ argument should be doing a numerical comparison, but both the Series field and my defined fields are strings.

If I flip things around and use the “!” operator. I have the same problem:
Code: [Select]
If(!IsEmpty([Series_themovieDBorg]),[Series_themovieDBorg],[Series])\gives me: <basePath>\Unknown Series_themovieDBorg\
and
Code: [Select]
If(!IsEmpty([Series_themovieDBorg],1),[Series_themovieDBorg],[Series])\gives me <basePath>\[Series]

I feel like I’ve been struggling with this long enough that I’m missing something elemental :-)

Any ideas? Thanks!
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: IsEmpty expression not matching strings?
« Reply #1 on: January 18, 2024, 01:15:35 pm »

When in the renaming business try checking against raw value
Code: [Select]
If(IsEmpty([Series_themovieDBorg,0]),[Series],[Series_themovieDBorg])
Logged

bspachman

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 896
Re: IsEmpty expression not matching strings?
« Reply #2 on: January 18, 2024, 03:45:35 pm »

When in the renaming business try checking against raw value
Code: [Select]
If(IsEmpty([Series_themovieDBorg,0]),[Series],[Series_themovieDBorg])

Of course! Thank you! It's been such a long time since I've messed with my rename expressions I entirely forgot about needing to protect pathnames from the possibility of null values. Making sure I had the '0' as an argument to the FIELD (inside the field's brackets) was the key.
Logged
Pages: [1]   Go Up