Brian Dunning's FileMaker Custom Functions

fileNameFormat ( _path ; _fileName ; _date ; _fileExt ; _theDatePosition )

Return the full path, including file name with a formatted date.

  Be the first to rate this function Log in to vote

Josh Ormond   Josh Ormond - Show more from this author
Iozax, LLC
http://iozax.com

Share on Facebook Share on Twitter

  Sample input:
fileNameFormat ( Get ( DesktopPath ) ; "SalesReport" ; Get ( CurrentDate ) ; "pdf" ; "after" )
fileNameFormat ( "" ; "SalesReport" ; "" ; "pdf" ; "" )
  Sample output:
/Macintosh HD/Users/johndoe/Desktop/SalesReport_2019-03-13.pdf
/Macintosh HD/Users/johndoe/Documents/2019-03-13_SalesReport.pdf

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

Return the full path, including file name with a formatted date. The _path, _date, and _datePosition all have built in defaults.

There is also a helper function that only requires the _fileName and _fileExt parameters, and sets the defaults for you. Function name is fileFormatDefault

 

Comments

Jonathan Mickelson   Jonathan Mickelson
May 6, 2019
Hi Josh,

Is there a reason the file extension filters out "n" & "m" ?
I think it would fail for ".mov"
You could replace with "qwertyuiopasdfghjklzxcvbnm1234567890"
 
Josh Ormond   Josh Ormond, Iozax, LLC
May 6, 2019
Thank you for pinging me Jonathan. I did correct that in our production files. I have updated the code to include the missing letters, and convert the file extension to lowercase. That will prevent problems if someone enters any uppercase case characters.
 

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: