INTERACT FORUM

Please login or register.

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

Author Topic: Expression in Rename dialog  (Read 1059 times)

InflatableMouse

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3978
Expression in Rename dialog
« on: May 09, 2013, 01:45:02 pm »

Is it possible to use an expression in the rename window to evaluate a field value and rename based on the outcome?

I have an [Album Version] field that I've been using to record the album release version. But the majority of albums don't have anything for that value though, so its empty.

I tried a couple of things, for instance:

Code: [Select]
[Artist]\/[[Year]/] [Album] if(isempty([Album Version]),,/([Album Version]/))

The preview works fine when [Album Version] has a value, but if its empty it adds (Unknown Album Version). I don't want it to add anything in that case but I can't seem to get it to work that way.

If anyone knows how to fix that I'd appreciate it.

Thanks!
Logged

6233638

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 5353
Re: Expression in Rename dialog
« Reply #1 on: May 09, 2013, 02:11:43 pm »

Delimit() should cover this, though you might have to use [Tag,0] for some values.

Code: [Select]
[Artist]\/[[Year]/] [Album]Delimit([Album Version,0],/),/ /()
Logged

InflatableMouse

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3978
Re: Expression in Rename dialog
« Reply #2 on: May 09, 2013, 02:38:02 pm »

That easy huh :D.

Works fine on a few samples I've tried, thank!

Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9161
Re: Expression in Rename dialog
« Reply #3 on: May 10, 2013, 12:44:35 am »

[Artist]\/[[Year]/] [Album] if(isempty([Album Version,0]),,/([Album Version]/))

Adding the ",0" to [album version] in your original expression would also have worked.

Using ",0" inside the field name tells MC to use the literal field contents. Before we got this, I would use isequal instead of isempty, asking, if the field contains 'unknown', output nothing, otherwise use the field.

-marko
Pages: [1]   Go Up