INTERACT FORUM

Please login or register.

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

Author Topic: expression to return directory name  (Read 1789 times)

ProblemChild

  • Junior Woodchuck
  • **
  • Posts: 97
  • But I don't wanna be the same as everybody else...
expression to return directory name
« 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.
Logged

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4580
Re: expression to return directory name
« Reply #1 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
Logged

ProblemChild

  • Junior Woodchuck
  • **
  • Posts: 97
  • But I don't wanna be the same as everybody else...
Re: expression to return directory name
« Reply #2 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 :-)
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72438
  • Where did I put my teeth?
Re: expression to return directory name
« Reply #3 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.
Logged

ProblemChild

  • Junior Woodchuck
  • **
  • Posts: 97
  • But I don't wanna be the same as everybody else...
Re: expression to return directory name
« Reply #4 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.
Logged
Pages: [1]   Go Up