INTERACT FORUM

More => Old Versions => Media Jukebox => Topic started by: chrisjj on August 19, 2010, 11:20:17 pm

Title: Expression to provide folder name and parent folder name
Post by: chrisjj 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.
Title: Re: Expression to provide folder name and parent folder name
Post by: marko 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
Title: Re: Expression to provide folder name and parent folder name
Post by: chrisjj 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.

Title: Re: Expression to provide folder name and parent folder name
Post by: marko 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 (http://wiki.jrmediacenter.com/index.php/Media_Center_expression_language), 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.
Title: Re: Expression to provide folder name and parent folder name
Post by: chrisjj 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 (http://wiki.jrmediacenter.com/index.php/Media_Center_expression_language), 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?
Title: Re: Expression to provide folder name and parent folder name
Post by: MrC on August 30, 2010, 11:34:18 am
You're welcome.  My "source?".  I suppose you mean this page (http://yabb.jriver.com/interact/index.php?topic=59116.0).
Title: Re: Expression to provide folder name and parent folder name
Post by: chrisjj 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
Title: Re: Expression to provide folder name and parent folder name
Post by: JimH on August 30, 2010, 04:41:08 pm
Fixed MrC's link above.
Title: Re: Expression to provide folder name and parent folder name
Post by: MrC on August 30, 2010, 04:43:11 pm
Oops, Gesundheit.
Title: Re: Expression to provide folder name and parent folder name
Post by: JimH on August 30, 2010, 04:46:59 pm
Die Fledermaus.
Title: Re: Expression to provide folder name and parent folder name
Post by: chrisjj 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!