INTERACT FORUM

Please login or register.

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

Author Topic: Running into a problem with expressions  (Read 1489 times)

hcm3

  • Recent member
  • *
  • Posts: 18
Running into a problem with expressions
« on: September 09, 2013, 05:10:52 pm »

I have a few expressions set up in some user library fields to build file paths and filenames for the Rename, Move, & Copy Files feature.

I am having a problem with the FirstNoEmpty() function in RM&CF. I set up a working custom view with the following expression:

Code: [Select]
Clean(Left(FirstNotEmpty([Artist Sort], ListItem([Artist],0), NO ARTIST!),30),3)
This is part of the filename expression of
Code: [Select]
if(IsEmpty([Disc #],1),FIX DISC NUMBER!,padnumber([disc #],2))-if(isempty([Track #],1),FIX TRACK NUMBERS!,padnumber([Track #], 2)) - Clean(Left(FirstNotEmpty([Artist Sort], ListItem([Artist],0), NO ARTIST!),30),3) - Clean(left([Name],50),3)
This view parses that filename expression correctly, but when I try using the same expression in RM&CF, I get an "Unknown Artist Sort" where the artist show be (The first expression above).

I've included a screenshot for reference.



The Location Test custom view and the RM&CF dialog are both using the same variable with the expression above for the filename.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Logged
The opinions I express represent my own folly.

hcm3

  • Recent member
  • *
  • Posts: 18
Re: Running into a problem with expressions
« Reply #2 on: September 09, 2013, 05:26:09 pm »

OK, I see why Unknown Artist Sort is being displayed in Rename, Move & Copy in contrast to the custom view.

I still don't understand (I know I'm dense) why the FirstNotEmpty() function isn't working correctly. It should first check [Artist Sort] for content, if empty it should check ListItem([Artist],0), which would be the first item in the Artist field list, and if THAT is empty (unlikely), display NO ARTIST!.

Does FirstNotEmpty() not work correctly in filenames?
 
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Running into a problem with expressions
« Reply #3 on: September 09, 2013, 05:28:59 pm »

[Artist Sort] is also subject to display output in RM&C.  Have you changed it to [Artist Sort,0] ?
Logged
The opinions I express represent my own folly.

hcm3

  • Recent member
  • *
  • Posts: 18
Re: Running into a problem with expressions
« Reply #4 on: September 09, 2013, 05:34:59 pm »

Ok, that worked. I wasn't aware that I could put a variable into raw mode like that. I thought that was only possible using the Field() function -Field(Artist Sort,0).

Thanks, I've been racking my brain on this all weekend!  :P
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Running into a problem with expressions
« Reply #5 on: September 09, 2013, 05:36:25 pm »

Have a quick re-read of Fields.

Don't think of [field] as a variable.  Stock fields and user fields - they are all just fields.
Logged
The opinions I express represent my own folly.

hcm3

  • Recent member
  • *
  • Posts: 18
Re: Running into a problem with expressions
« Reply #6 on: September 09, 2013, 05:55:50 pm »

Yes, you are correct. I misspoke. I meant I wasn't aware I was able to put the abbreviated form of [Album Artist] versus Field(Album Artist) into raw mode like you stated.

Thanks again for your help!

Now if only the expression editor could retain formatting correctly...  ;D
Logged
Pages: [1]   Go Up