Brian Dunning's FileMaker Custom Functions

FilterFileName ( text ; filetype )

filtering field contents as a file name when exporting record set to Excel or Acrobat file

  Average rating: 4.5 (34 votes) Log in to vote

Michael Myett   Michael Myett - Show more from this author
FileMaker Apps

Share on Facebook Share on Twitter

  Sample input:
Filter File Name ( team , 1 )
  Sample output:
red sox.xls

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

FileMaker allows you to export record sets to either an Excel or Acrobat file. If you are using a scripted export routine using some field contents as an automated file name, this function will filter any characters that would cause a illegal file name ( in windows ). This will avoid an error when running your script, by removing illegal characters.

For example, use the formula to set a variable in a script which exports a record set to an Excel or Acrobat file. The variable would create a filtered file name with illegal characters removed. This is good for Windows only. Sorry. I don't have access to a Mac to work that out and believe there are some different characters. Anyone who would like to add to this for Mac, feel free.

Make file type = 1 to add a Excel file extension to file name or file type = 2 for Adobe Acrobat file extension.

 

Comments

Sean   Sean, Private
Mar 3, 2011
I would change the second parameter to be the extension. That way this function could also be used when exporting container contents.
 
Denise   Denise, Boston
Mar 28, 2014
Exactly what I was looking for. Thank you so much!
 
Martin Pineault   Martin Pineault, f.i.SCIENCES Développement inc.
Oct 9, 2020
Missing the filename length maximum (32,767-ext) to trunk it. You won't believe what a user is capable of!
 

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: