File-Based Script Steps in FileMaker 18

I love it when FileMaker, Inc. releases new versions of their database tools! And, now that FileMaker Pro 18 Advanced is available, I’m still feelin’ that love. There are so many new tools in 18 that allow us developers at The Support Group to enhance our customers’ applications — I love exploring what can we can do and this time is no exception.

With this version, FileMaker, Inc. more than doubled the file-based script steps so now developers have 21 script steps instead of 10. All of the new steps allow us to create, read and write to and from, and manage external files. Granted, all of the functionality was available before using third-party tools (such as Troi File Plugin and the invaluable Monkey Bread Software MBS plugin), but now we can do this directly – natively – within FileMaker. Note that these new steps are probably the most complex of the new functions in FileMaker 18. Below is a list of the new steps.

  • Close Data File
  • Create Data File
  • Delete File
  • Get Data File Position
  • Get File Exists
  • Get File Size
  • Open Data File
  • Read from Data File
  • Rename File
  • Set Data File Position
  • Write to Data File
file-based script steps in FileMaker 81
Read, Write & Manage External Files

Rather than give an exhaustive “how-to” on using these new steps, I’d rather give a few examples of what we can do.

So what kind of files are we talking about and why would we want to read, write and manage them? With the new tools, we can create simple text documents, edit CSV files and more. We can move or delete those files and we can rename them. There’s a boatload of functionality that we can access, so let’s look at a few specific cases where we may want to use these steps.

file based script steps in FileMaker 18

At the moment, many of us load and save a user’s personal preferences within a record in the FileMaker solution. If a user has three or four distinct apps that have the same preferences – for example, how a phone number is formatted or how they want their name displayed in the database – we would need to store that data in each app. With the new functionality, we can save those individual preferences once to a preferences file, read that file, then use that data without having to re-create the preferences table and record in each solution.

Another nifty use is adding custom headers to CSV exports. Previously we had to use a custom function and some XML to add custom headers to an export intended for Excel. Now we can write a line of code to the exported file specifically using the new Set Data File Position step to add our custom headers. This is quicker and more efficient than was previously possible.

The new Data File steps, used in conjunction with the new-to-18 error logging script steps, allow us to create error logs automatically. When you combine that with other user-specified data – notes, perhaps – that can enhance the interaction between the user and the app developer when problems arise.

One last possible use I’ll mention is in multiple-language apps. Some previous implementations of FileMaker solutions used one or more language tables to store the UI elements in different languages. Now that it’s easy to read from external files, we can have the textual UI elements in an external languages file. This is how many other applications localize the UI.

Once one starts thinking of using the new functionality in FileMaker 18, like import features, calculation functions and advanced security enhancements, there are countless ways we can improve our custom apps. Exciting!

Join our mailing list to keep up with the new features in FileMaker 18.

Liked Liked
Need FileMaker Development Help? Or to purchase FileMaker Software?
Contact FM Pro Gurus for help