INTERACT FORUM

Please login or register.

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

Author Topic: Expression language and file paths  (Read 2067 times)

raldo

  • Citizen of the Universe
  • *****
  • Posts: 1102
Expression language and file paths
« on: March 07, 2018, 03:20:31 pm »

Hello,

I'm trying to make an expression for the rule part of a move and copy files operation.

The rule fails on a listitem expression which operates on a backslash delimited string. It seems as if MC behind the scenes replaces the backslash with underscores before inserting the parameter to the Listitem( ..) method.
assuming .Events for a file is a\b\c, then the following works and yields 2017 Summer a
[Year] [.Season] listitem([.Events,0], 0,  _)

Whereas using a backslash in the third parameter doesn't work.

Does anyone know away around this? Apart from never using underscores in .Events?
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9143
Re: Expression language and file paths
« Reply #1 on: March 07, 2018, 03:23:43 pm »

Assuming the "backslash delimited string" is a library field, try using use [field name,0] in your expression?

raldo

  • Citizen of the Universe
  • *****
  • Posts: 1102
Re: Expression language and file paths
« Reply #2 on: March 07, 2018, 03:54:23 pm »

Isn't that what I'm doing here:??
[Year] [.Season] listitem([.Events,0], 0,  _)
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9143
Re: Expression language and file paths
« Reply #3 on: March 07, 2018, 04:17:30 pm »

'tiz indeed, sorry about that.

I've not got an MC in front of me at the moment, but, up near the top of the rename tool, there's a tickbox about replacing slashes in expressions that I've never used... I can't recall exactly what it does. Is that any use for you?

The other thing I wondered was...

If you just want item zero, and just used [.Events] without the listitem, I'm almost sure it just defaults to item zero anyway, but again, without being able to test, I could be wrong about that too as it probably only does that for semicolon delimited lists. :)

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9143
Re: Expression language and file paths
« Reply #4 on: March 08, 2018, 12:39:06 am »

OK, I have an MC now...

The tick box is actually at the bottom, beneath the preview area, and seems to have no bearing on this.

I've also tested here using my keywords field, which contains nested keywords... ie., back slashes, and it seems to be working just as expected...
In the folder section...

and the file name section...


Any other tips for reproducing?

raldo

  • Citizen of the Universe
  • *****
  • Posts: 1102
Re: Expression language and file paths
« Reply #5 on: April 22, 2019, 02:59:53 pm »

Sorry, Marko, I just realized that I never thanked you for solution. Thanks!
Logged
Pages: [1]   Go Up