INTERACT FORUM

Please login or register.

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

Author Topic: Help with expression please  (Read 2210 times)

jctcom

  • Citizen of the Universe
  • *****
  • Posts: 654
  • Rush - Styx - Yes - Porcupine Tree - Staple Food!
Help with expression please
« on: October 31, 2015, 12:52:28 pm »

Hey I know this is probably pretty simple for the expression gurus out there.  But Me not programmer (I don't even like doing my accounting!)  hehe.

But I need one of two things please.

Either I need an expression that will take an existing field like [Name] and in the rename / move area automatically use the "Sorted" version of that name for the move So "The Gunman" becomes "Gunman, The" for the file name.

Or

I would create a new field [Name Sorted] and the data would automatically be pulled from the existing one [Name] and be correctly renamed as the sort field.

Much thanks in advance.

Carl

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8009
Re: Help with expression please
« Reply #1 on: October 31, 2015, 01:31:26 pm »

This expression will transform "The Artist" into "Artist, The".  It outputs NOTHING if the artist doesn't start with The.

Code: [Select]
=if(Regex([Artist],/#^(The)\s+(.+)#/, 0,0),[R2]/, [R1],)
You could easily modify it to output the Artist field if there is no "the".  This expression WILL NOT WORK in the Rename, Move, and Copy tool.  You'll need to use this expression to create a new field, as you described, and  then use that field name in the RM&C tool.

Please do some experiments first, use the preview window, and generally be really careful.  Good luck!

Brian.
Logged

jctcom

  • Citizen of the Universe
  • *****
  • Posts: 654
  • Rush - Styx - Yes - Porcupine Tree - Staple Food!
Re: Help with expression please
« Reply #2 on: October 31, 2015, 01:49:17 pm »

Thanks Brian.

How would I add the other Articles to that like "A", "An", "La", "Le" etc...

Basically I want to create a sort field for Movie and TV Series  (I'm surprised it doesn't already exist?  Or am I just not seeing it somewhere?)

Thanks again.

Carl.

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8009
Re: Help with expression please
« Reply #3 on: October 31, 2015, 02:10:32 pm »

MC is supposed to be able to sort and ignore any kind of article.  (A, The ,etc)  I was going to mention this, but you said you wanted to use Rename, so I went with it.

If you're just trying to sort and ignore articles, set the option!  :)

Tools > Options > Tree & View > Sorting > Ignore Articles > (checked)

If you still need help past that, I'll see what I can do.

Brian.
Logged

jctcom

  • Citizen of the Universe
  • *****
  • Posts: 654
  • Rush - Styx - Yes - Porcupine Tree - Staple Food!
Re: Help with expression please
« Reply #4 on: October 31, 2015, 02:15:41 pm »

I do already have that set.

But as you said this is for the purpose of creating a Rename / Move expression.  If I use the [Name] field in a Rename / Move expression it does not create the folder / file names with the correct sort option(S).

Carl.

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8009
Re: Help with expression please
« Reply #5 on: October 31, 2015, 02:33:50 pm »

Ok, here's how you modify the expression.  Take this middle part here:

#^(The)\s+(.+)#/

...and add "or" conditions like:

#^(The|A)\s+(.+)#/

A "|" character (pipe or vertical bar, NOT an l) means "or".  You can add more so:

#^(The|A|Le)\s+(.+)#/

That should work, but please test it.  Good luck!

Brian.
Logged

jctcom

  • Citizen of the Universe
  • *****
  • Posts: 654
  • Rush - Styx - Yes - Porcupine Tree - Staple Food!
Re: Help with expression please
« Reply #6 on: October 31, 2015, 02:46:29 pm »

Thanks a lot.

I just realized during our conversation that I had created a similar expression for sorting Artists (With the help of the forum of course).

So I just took that and substituted [Name] for [Artist].

appreciate your break down though.  Creates some actual comprehension.  lol

Carl.
Pages: [1]   Go Up