Brian Dunning's FileMaker Custom Functions

GetItemName ( Path )

Gives back the name of a file or a folder from a path

  Average rating: 4.2 (5 votes) Log in to vote

Christophe Cossement   Christophe Cossement
Lemon Pie
http://www.cobraradiobrewery.com

Share on Facebook Share on Twitter

  Sample input:
Get ( DocumentsPath )
/User/.../Documents/Test.txt
/User/.../Documents/Test/
  Sample output:
Documents
Test.txt
Test

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

This function changes the "/" in a path to "¶" to get a list, then gives the last element of this list

 

Comments

comment   comment, VR
Jan 22, 2017
RightValues ( Substitute ( path ; "/" ; "¶" ) ; 1 )

would have worked just as well.

Let (
v = Substitute ( path ; "/" ; "¶" )
;
GetValue ( v ; ValueCount ( v ) )
)

would work even better, since it would return the last token witout a trailing carrige return.
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: