INTERACT FORUM

Please login or register.

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

Author Topic: Expression Help Please ...  (Read 2584 times)

tombert

  • Galactic Citizen
  • ****
  • Posts: 449
Expression Help Please ...
« on: January 09, 2011, 07:12:59 am »

Trying to build the following expression:

If(IsEqual([Album Artist (auto)],/(Multiple Artists/),1),[Album],[Artist]\[Album])

In the pane window the expression is correctly displayed, but when using it in e.g. file copy operations then the backslash is replaced with an underscore.

Pane:
Herbert Grönemayer\Mensch

File copy:
Herbert Grönemeyer_Mensch

thx
Logged

lise

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Expression Help Please ...
« Reply #1 on: January 09, 2011, 11:34:25 am »

Try putting a forward slash before the backslash that you want, e.g.

If(IsEqual([Album Artist (auto)],/(Multiple Artists/),1),[Album],[Artist]/\[Album])

forward slash acts as the escape character (I think that's the term used) enabling the next character to show up as a character.
Logged
A wise man once said don't count your years, but make your years count. Or was it beers?

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Expression Help Please ...
« Reply #2 on: January 09, 2011, 12:02:41 pm »

lise, I don't think that's going to work because typically, the backslash character does not need to be escaped.

tombert,
Where/how are you initiating the file copy operation?

If I use your given expression in the directory rule of the "Rename move and copy files" tool, it works as expected, without an underscore.
You saved the expression as a custom library field, right?

If I am right, let's say your custom field is called [folder], when you use it in the rename move and copy tool, try wrapping it in a replace() expression...

replace([folder],_,\)

Does that help?

-marko.

tombert

  • Galactic Citizen
  • ****
  • Posts: 449
Re: Expression Help Please ...
« Reply #3 on: January 09, 2011, 01:03:03 pm »

Try putting a forward slash before the backslash that you want, e.g.

If(IsEqual([Album Artist (auto)],/(Multiple Artists/),1),[Album],[Artist]/\[Album])

forward slash acts as the escape character (I think that's the term used) enabling the next character to show up as a character.

Doesn't work - it's still replaced by an _
Logged

tombert

  • Galactic Citizen
  • ****
  • Posts: 449
Re: Expression Help Please ...
« Reply #4 on: January 09, 2011, 01:06:47 pm »

lise, I don't think that's going to work because typically, the backslash character does not need to be escaped.

tombert,
Where/how are you initiating the file copy operation?

If I use your given expression in the directory rule of the "Rename move and copy files" tool, it works as expected, without an underscore.
You saved the expression as a custom library field, right?

If I am right, let's say your custom field is called [folder], when you use it in the rename move and copy tool, try wrapping it in a replace() expression...

replace([folder],_,\)

Does that help?

-marko.


This replace stuff works ... it complicates the "ease" of use ... but it works ...
thx
Logged

Vincent Kars

  • Citizen of the Universe
  • *****
  • Posts: 1154
Re: Expression Help Please ...
« Reply #5 on: January 09, 2011, 03:11:16 pm »

I think it is by design.

The \ is used in Win for dirs. So having \ in a filename might yield unwanted results.
Logged
Pages: [1]   Go Up