INTERACT FORUM

Please login or register.

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

Author Topic: Expression to provide folder name and parent folder name  (Read 3889 times)

chrisjj

  • Citizen of the Universe
  • *****
  • Posts: 750
Expression to provide folder name and parent folder name
« on: August 19, 2010, 11:20:17 pm »

Can anyone tell me the expressions to provide the folder name and the parent folder name? E.g. from a filepath aaa/bbb/ccc.eee, provide bbb and aaa?

I find there is a field [Filename (name)] that provides ccc.eee bit I can find none for these folder names, nor any function to extract folder names from the filepath field.

Thanks.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Expression to provide folder name and parent folder name
« Reply #1 on: August 20, 2010, 01:23:17 am »

For the following strings to work, you must be using MJ14 as MJ12 does not have the math capability.
You'll need to add a couple of custom fields to your library. They'll be calculated fields, and the expressions for each will be:

aaa  =ListItem([Filename (path)],Math(ListCount([Filename (path)],\)-2),\)

bbb  =ListItem([Filename (path)],Math(ListCount([Filename (path)],\)-1),\)

Copy/paste all of the blue text.

You could also use both of these strings to add expression columns or categories to a view directly. Just ask if you're not sure what I mean by that.

Regards,

-marko

chrisjj

  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Expression to provide folder name and parent folder name
« Reply #2 on: August 25, 2010, 07:01:28 am »

> aaa  =ListItem([Filename (path)],Math(ListCount([Filename (path)],\)-2),\)
> bbb  =ListItem([Filename (path)],Math(ListCount([Filename (path)],\)-1),\)

Excellent - thanks Mark.

BTW, re:

> You'll need to add a couple of custom fields to your library.

I found this unnecessary for my use in the Device Audo Path - the Options field accepted these expressions directly.

> For the following strings to work, you must be using MJ14 as MJ12 does not have the math capability.

Can you tell me where the Math() function is documented? Not in the Help, as far I can see.

Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Expression to provide folder name and parent folder name
« Reply #3 on: August 25, 2010, 11:55:59 am »

Your welcome.

Quote
I found this unnecessary for my use in the Device Audo Path - the Options field accepted these expressions directly.
Indeed. You could also use them to create file list columns or view categories directly. I suggested using them to add custom fields as you did not state how/where you wanted to use the information, and as a library field, you could use it just about anywhere you fancied.

Quote
Can you tell me where the Math() function is documented? Not in the Help, as far I can see.
It's one of the functions missing from the expressions page on the wiki, which is currently being re-written. That's a slow process though and the new page probably won't surface for another week or two.

-marko.

chrisjj

  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Expression to provide folder name and parent folder name
« Reply #4 on: August 30, 2010, 06:56:45 am »

I suggested using them to add custom fields as you did not state how/where you wanted to use the information
Indeed I omitted to say. Thanks.

It's one of the functions missing from the expressions page on the wiki, which is currently being re-written. That's a slow process though and the new page probably won't surface for another week or two.
Thanks MrC for this subsequnt addition: http://wiki.jriver.com/index.php?title=Media_Center_expression_language&diff=6799&oldid=6164

Is MrC's source publicly visible?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Expression to provide folder name and parent folder name
« Reply #5 on: August 30, 2010, 11:34:18 am »

You're welcome.  My "source?".  I suppose you mean this page.
Logged
The opinions I express represent my own folly.

chrisjj

  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Expression to provide folder name and parent folder name
« Reply #6 on: August 30, 2010, 04:38:32 pm »

I suppose you mean this page.

I get:

Quote
An Error Has Occurred!
The topic or board you are looking for appears to be either missing or off limits to you
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72439
  • Where did I put my teeth?
Re: Expression to provide folder name and parent folder name
« Reply #7 on: August 30, 2010, 04:41:08 pm »

Fixed MrC's link above.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Expression to provide folder name and parent folder name
« Reply #8 on: August 30, 2010, 04:43:11 pm »

Oops, Gesundheit.
Logged
The opinions I express represent my own folly.

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72439
  • Where did I put my teeth?
Re: Expression to provide folder name and parent folder name
« Reply #9 on: August 30, 2010, 04:46:59 pm »

Die Fledermaus.
Logged

chrisjj

  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Expression to provide folder name and parent folder name
« Reply #10 on: September 08, 2010, 08:48:00 am »

Fixed MrC's link above.
Thanks Jim.

And thanks MrC for the page - very nice to see the "secret" functions listed. It will be great when these are made official and documented!
Logged
Pages: [1]   Go Up