INTERACT FORUM

More => Old Versions => Media Center 13 (Development Ended) => Topic started by: ProblemChild on June 27, 2009, 12:53:08 pm

Title: expression to return directory name
Post by: ProblemChild on June 27, 2009, 12:53:08 pm
Can someone please offer some help with an expression?
I just want an expression that returns the directory name from the path.

This:
Code: [Select]
=ListItem([Filename (path)],ListCount([Filename (path)],\),\)returns an empty string since the function ListItem() is zero-based (ie ListCount returns the number of items
in the list, but if there are 4 items in a list, the last item is numbered 3, not 4).

Adding "-1" to the expression:
Code: [Select]
=ListItem([Filename (path)],ListCount([Filename (path)],\)-1,\)
doesn't work because
Code: [Select]
=ListCount([Filename (path)],\)-1 returns the text "4-1", not the numeric value 3.

Is there a syntax here I'm missing? Thanks.
Title: Re: expression to return directory name
Post by: gappie on June 27, 2009, 04:02:00 pm
i think this might work:
Code: [Select]
=ListItem([Filename (path)],Math(ListCount([Filename (path)],\)-1),\)notice the math expression. works for calculations.

 ;)
gab
Title: Re: expression to return directory name
Post by: ProblemChild on June 27, 2009, 07:20:25 pm
That works great. Thank you.

I haven't used MC for many months. In looking up Math() I also see Pow().
Is there somewhere I can find documentation on these and other newly-added functions?
I can scan the list in the Expression Editor wizard but that's an incomplete list - it doesn't list Pow(), for instance.

Or is there a listing somewhere of each version and its changes? I know there are the many
"Media Center 13.0.XXX Available Here" pages but they only give information on a few versions.
Is there a complete listing somewhere? Even just a list of links to all the other "Media Center 13.0.XXX Available Here" pages?

I'm a huge MC fan and have been for years but this has consistently been my biggest frustration - written documentation.
In any case, thanks a lot for your help :-)
Title: Re: expression to return directory name
Post by: JimH on June 27, 2009, 07:23:41 pm
Or is there a listing somewhere of each version and its changes? I know there are the many
"Media Center 13.0.XXX Available Here" pages but they only give information on a few versions.
Is there a complete listing somewhere? Even just a list of links to all the other "Media Center 13.0.XXX Available Here" pages?
Alex B keeps a history.  It's in his signature.
Title: Re: expression to return directory name
Post by: ProblemChild on June 28, 2009, 01:51:46 pm
That's great!
Grepd "NEW" and got caught up on a LOT of things I didn't know about!
Thanks for putting that together, Alex B.