Dealing with FileMaker export paths

 In FileMaker
dealing-with-filemaker-export-paths

At one point or another clients inevitably ask for a way to export FileMaker data out of the system, usually a PDF report, invoice, statement or even chart. It makes sense in most cases to dynamically create the FileMaker export paths based on the relevant record data, not only for recognition but also to keep it semi unique in the filesystem.

For example in the case of an invoice the $filename variable could be:
"Invoice-" & Invoice::_ID & Invoice::NameCompany & Invoice::DateSent & ".pdf"

resulting in a file called:
Invoice-2700NicksPlumbing20150607.pdf

Great huh? While this poses no obvious issues you have just pinned the the chances of completing a successful export on the quality of the clients data. The issue is we assume that the data in the fields Invoice::_ID, Invoice::NameCompany and Invoice::DateSent will not contain any characters that the users operating system (Windows, OS X or even IOS) cannot deal with. In the case of the Invoice number and Date Sent if the fields are auto entered or validated correctly when creating an invoice record they should be fine, but what about Company Name? There is a whole raft of characters that could be valid in a company name but will break a file path, the most popular we see is “Dans Company P/L” or a cut and paste from an email with a carriage return at the end.

Enter the custom function CleanPath

Filter (text ; "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_- ")

while extremely simple it gets the job done, saves a copy and paste, allows for quick update to the function across the system (maybe adding multilingual character support?) and ensures the user will never see the “Save to Disk” error.

If you have any questions or queries feel free to contact us

Recommended Posts

Leave a Comment

FileMaker PHP returning the last record ID