Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
Training
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages
Videos
Adventures
Links

Shopping Cart
Shopping Cart

Search:

Free Newsletter
Signup


Contact


Privacy Policy



FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.

 

 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

PathParser ( thePath ; returnElementPHFNE )

Rate this function:  

RatingRatingRatingRatingRating
  Average rating: 4.5  (13 votes)
  Discuss this Custom Function

Lewis Lorenz, Lorenz Companies
http://www.LorenzCom.com

PathParser returns the directory path, home directory, full filename and extension, filename, or extension from a folder and/or file path string.

Sample Input:
PathParser ( "file:" & Get ( DocumentsPath ) & "Untitled.pdf" , "p" )
PathParser ( Get ( DocumentsPath ) & "Untitled.pdf" , "h" )
PathParser ( Get ( DocumentsPath ) & "Untitled.pdf" , "fullfilename" )
PathParser ( Get ( DocumentsPath ) & "Untitled.pdf" , "n" )
PathParser ( Get ( DocumentsPath ) & "Untitled.pdf" , "e" )
PathParser ( Get ( DocumentsPath ) & "Untitled.pdf" , "2" )
PathParser ( Get ( DocumentsPath ) & "Untitled.pdf" , "-1" )
Sample Output:
file:/Macintosh HD2/Users/user/Documents/
/Users/user/Documents/
Untitled.pdf
Untitled
pdf
/user/Documents/
/Macintosh HD2/Users/user/


 Then copy & paste into FileMaker Advanced's Edit Custom Function window.

Description:

PathParser ( thePath , returnElementPHFNE )

PathParser returns the directory path, home directory, full filename and extension, filename, or extension from a folder and/or file path string.

- Easily extract path elements from thePath.
- Preserves FileMaker Pro file reference prefixes (file:, filemac:, and filewin:).
- Omit directories forwards or backwards from thePath.
- The home or ~ (tilde) element request returns the home path - path without Get ( SystemDrive ) prepended.
- Works with the thePath string as passed - it does not format thePath, except to prepend a missing path separator when returning path or home requests.
- Uses the leftmost path separator in thePath to delineate path elements.
- Use with the PathMaker custom function for added path formatting control.

Parameters:

- thePath - A folder and/or file path.
- returnElementPHFNE - The element in thePath to return. Determined from the first letter of the passed parameter or the number:
- [p]ath: Returns the directory path, without the filename and extension.
- [h]ome or ~: Returns the home directory path, without the system drive information.
- [f]ullfilename: Returns the filename and extension, without the path directory.
- [n]ame: Returns the filename, without the path directory and without the file extension.
- [e]xtension: Returns the file extension, without the path directory and without filename.
- [+/-#]: Returns the path after omitting the specified number (#) of directories from the left or right of thePath.
- A positive number omits directories forwards from the left.
- A negative number omits directories backwards from the right.

Examples:

- PathParser ( "file:" & Get ( DocumentsPath ) & "Untitled.pdf" , "p" ) = file:/Macintosh HD2/Users/user/Documents/
- PathParser ( Get ( DocumentsPath ) & "Untitled.pdf" , "h" ) = /Users/user/Documents/
- PathParser ( Get ( DocumentsPath ) & "Untitled.pdf" , "fullfilename" ) = Untitled.pdf
- PathParser ( Get ( DocumentsPath ) & "Untitled.pdf" , "n" ) = Untitled
- PathParser ( Get ( DocumentsPath ) & "Untitled.pdf" , "e" ) = pdf
- PathParser ( Get ( DocumentsPath ) & "Untitled.pdf" , "2" ) = /user/Documents/
- PathParser ( Get ( DocumentsPath ) & "Untitled.pdf" , "-1" ) = /Macintosh HD2/Users/user/

Help:

- Passing '?' as the leftmost text in returnElementPHFNE returns this help text: PathParser ( thePath , returnElementPHFNE: [p]ath, [h]ome or [~], [f]ull name and extension, [n]ame, [e]xtension), [+/-#] omit # of directories ).

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

This is my Custom Function and I want to edit it

Discuss:

5 most recent comments | Show all 7 comments

I haven't had issues with this. Can you supply more information?

Lewis Lorenz, Tulsa
January 25, 2018 9:22am

I too am having the same issue with the error "The specified parameter can't be found" in reference to "thePath." I copied and pasted it directly from the site. Is there anything else that needs to be done prior to trying to save the custom function? Thank you in advance.

Steve, Dallas
May 08, 2018 4:59pm

I am happy to fix this, but I can not replicate this issue. Please contact me at lewis@lorenzcom.com with information about how you encountered this error.

Thank you.

Lewis Lorenz, Tulsa
May 09, 2018 6:53am

Sure, I will email you in a second. Thanks!

Steve, Dallas
May 09, 2018 3:16pm

Actually, I figured out what I was doing wrong. I had not set the Function Parameters. Thank you for your custom function and willingness to help. Much appreciated!

Steve, Dallas
May 09, 2018 3:32pm

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
City/Location:
Comment:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 1 + 5 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. HexUUIDToNum_cf (_uuid)
  (Sat, Jun 16, 1:55pm)
2. httpResponseCode ( responseHeaders )
  (Tue, Jun 12, 10:40pm)
3. FindDuplicateCharacters ( string )
  (Fri, Jun 08, 5:01pm)
4. FieldRepetitionLast ( field ; maxRepetition )
  (Wed, Jun 06, 6:05pm)
5. CountModifiedRecords ( NameTimestampField ; StartTimestamp ; EndTimestamp )
  (Mon, May 28, 8:23am)
6. JSONArrayLength ( JSONArrayStr )
  (Fri, May 25, 7:46am)
7. interpolation (y1; y2; y3; x1; x2; x3; x1y1; x2y1; x1y2; x2y2; rnd)
  (Sat, May 19, 3:55am)
8. @JSONFormatElements ( json )
  (Tue, May 15, 3:31am)

RSS Feed of Custom Functions