Custom Function Techniques

Last time I gave some of my reasons for enjoying custom functions so much. I also pointed out a few of the limitations of custom functions that I hope will be addressed some day. Until then, here are some simple and not-so-simple techniques you can use when working with custom functions to make them a bit easier to deal with.

All of the custom functions mentioned here (and a couple hundred others) are available in my open source custom function library.

Read more: Custom Function Techniques

Glorious Custom Functions

This is the first in a two part series of articles regarding FileMaker’s custom function feature. I’ve seen a number of opinions that deride the excessive use of custom functions for various reasons. In this first part I’ll outline what I do (and don’t) like about FileMaker’s implementation. Next time I’ll offer some tips on how, at least to some extent, you can overcome what limitations do exist.

Read more: Glorious Custom Functions

Xcode 5: Start to Finish

While most of my work is with FileMaker and PHP, I have been delving into native OS X and iOS apps, and was fortunate to be invited to perform technical editing and code review services for the new Xcode 5 Start to Finish: iOS and OS X Development book by Fritz Anderson. I've been anxiously awaiting its publication and received my copy in yesterday's mail.

This is the second time I've worked as a technical reviewer for a book, the first being quite some time ago with The Book of FileMaker 6. Interestingly, the publishers weren't aware of my experience when they extended the invitation. It actually originated from my criticisms of Fritz's previous book, Xcode 4 Unleashed. I often try to express constructive criticism of books and software, and the authors of both have always been receptive. I don't know if other industries are as welcoming, but if you ever come up with ways to improve the products you use, I highly recommend sharing your ideas with the author. Every creator wants to release the best product they can, and as the open source community knows, "given enough eyballs, all bugs are shallow."

Regardless, if you're looking for a very readable introduction to the deep guts of Xcode 5, I highly recommend Fritz's work.

FileMaking 5: Welcome to FileMaker 8!

Welcome to FileMaker 8!

We’re going to take a break this month from our usual tutorials and look at the newest version of FileMaker, which was released last month. Version 8 of FileMaker Pro, FileMaker Pro Advanced, FileMaker Server and FileMaker Server Advanced are all available, and FileMaker Mobile 8 is going to be released soon.

Read more: FileMaking 5: Welcome to FileMaker 8!

Naming Custom Dialog Buttons

To increase the readability of your scripts, assign button values to script variables when using Show Custom Dialog. I usually use the dialog's message calculation for this, but the title works just as well, or now that FileMaker 13 allows the use of calculations for button text, you could place the calculations there.

show custom dialog

With such variables in place, your testing code can reference the button names instead of those impersonal numbers.

If[Get( LastMessageChoice ) = $ok_button]
  # Do OK stuff.
Else If[Get( LastMessageChoice ) = $cancel_button]
  # Do Cancel stuff.
End If

FileMaker Or...

I don't spend a lot of time on FileMaker's TechNet. Usually when I am looking for a FileMaker answer I go to FMForums. I've been using that web site for over a decade, so it's just natural for me to go there instead. However, aparently a member there, Daniel Wilhelm, posted there about his frustration with FileMaker and Tim Dietrich responded with his own struggles with FileMaker, which got me thinking about FileMaker's place in my business.

Read more: FileMaker Or...

Field Comment Metadata

Today an interesting puzzle came across my path. Well, I found the puzzle somewhat interesting, but I began to be fascinated by the solution I had come up with for it, which I think is rather novel.

Here's the puzzle: Given a FileMaker system that uses merge fields in text blocks to construct form letters with a different layout for each form letter, how would you build a system that eliminated the need for the multitude of layouts.

Read more: Field Comment Metadata

FileMaking 4: Common Functions

Here's a republication of the fourth article in my FileMaking series from About This Particular Macintosh.

Common Functions

Last month, we continued our education about FileMaker calculations, introducing the flexibility that FileMaker offers: Many built-in functions can be used to perform the same job, and our example of this was extracting a letter grade from a percentage. We’ll continue our look into calculations and functions this month, concentrating on a few of the most popular that FileMaker offers. You’ll probably build few calculations that don’t use at least one of these functions. We covered one of these, the Case() function, last month.

Read more: FileMaking 4: Common Functions

Odd Password Restrictions

For what I hope are obvious reasons, over the last few years I've become a more security conscious, is particular, with regards to password selection. I only actually remember two passwords, both of which are fairly strong but easy for me to remember, each of which is used in exactly one place, the account on my Mac and the key to unlocking my 1Password database. Given my use of 1Password, if I know only these two passwords, I can get access to any other. All other private information is also stored in 1Password, including recovery codes for two-step authentication and my FileVault2 recovery key.

My other passwords, randomly generated by 1Password, therefore tend to be very strong. My default recipe in 1Password uses 20-character passwords that include upper and lower case letters, digits and punctuation.

An yet, for various reasons, some web sites won't allow such passwords. Sometimes there's a limit on the password size, usually around 15 or 16 characters. Sometimes the site won't allow punctuation, or particular symbols. And honestly, I've never understood why. Is it so much more difficult to store a hash (and I do hope they're storing hashes instead of plaintext) of "n3X8P6T9s>^j*/Gvws(3" than "8uTZTau9PBiP663"?

Read more: Odd Password Restrictions

FileMaking 3: Calculations in Depth

The third article in my series for About This Particular Macintosh.

Read more: FileMaking 3: Calculations in Depth

FileMaker, AppleScript, PHP, Oh My!

This has been an interesting week for my development process. Usually I spend my time working predominately within a single language at a time, but this past week I've delved into Java, FileMaker, shell scripting, PHP and AppleScript, all for a single solution.

Read more: FileMaker, AppleScript, PHP, Oh My!

FileMaker Dictionary

Elsewhere on the intertubes there have been a few techniques for implementing dictionaries in FileMaker. If you aren't familiar with them, dictionaries (known in some languages as associative arrays or maps) allow the storage of key/value pairs. I've come across them in PHP, REALbasic and Objective-C, and they're quite useful. The basic idea is that you store key-value pairs of data. Each key can appear only once but can hold any kind of data.

Although I've used other people's dictionary techniques in my solutions, I've been unhappy with them for a number of reasons. First of all, I find them poorly documented. Even though some of them include lengthy articles regarding their use, wading through the articles is difficult and doesn't seem to bring much clarity. Second, I'm unhappy with their storage methods. Both of the solutions I've come across use esoteric delimiters for the data, making them difficult to read. Finally, they don't fully implement the dictionary ideal, in that keys can be duplicated. While this comes in handy because the one I was using in a recent solution didn't support lists as a data type, I prefer the cleanliness of single key restrictions.

So as much as I would prefer to use someone else's prewritten solution to this technique, I'm going to write my own.

Read more: FileMaker Dictionary

A First Time for Everything

A Natural Born Reader

I read. A lot. I read articles on the Internet about FileMaker and Objective-C and Cocoa and PHP. I read artciles about politics and copyright and libertarian ideas. I read books about history and philosophy. I read blogs from people I admire and enjoy. I read books for entertainment, especially science fiction and comic books. I read fictional classics that I've heard about my whole life but have never gotten to. I read to my kids, choosing books that I enjoyed and hope they will too. I even read books about reading, wanting to learn to draw as much as possible from the works I spend time on.

Read more: A First Time for Everything

FileMaking 2: Fields and Calculations

Article number 2 from the original About This Particular Macintosh series. Note that although 90% of this article is still relevant to FileMaker 12, some information is obsolete, especially with the introduction of script variables in FileMaker 8.

Fields and Calculations

In last month’s article, we provided a quick introduction to FileMaker Pro 7 by creating a simple relational database to track serial numbers. As the article proved fairly popular given the feedback received from readers, we’re going to make this FileMaker tutorial into a regular feature. This month, we’ll continue to work with our SerialNumbers.fp7 file, augmenting its capabilities a little bit at a time. If you didn’t read last month’s article, I would highly recommend that you do so before continuing, as I will assume that you know how to do what was covered there.

Read more: FileMaking 2: Fields and Calculations

Changing Passwords Across FileMaker Files

Ever since FileMaker 7 was released developers have had the ability to create solutions within a single file. While I tend to create single-file systems, there are times when it's useful to break a solution into multiple files. Alternatively, even a decade after the release of FileMaker 7, I still occassionally come across systems that were originally created in FileMaker 6 or earlier and were never consolidated into a single file.

This latter case is something I came across recently with a system that I'd been hired to make a few changes to. One of the requested changes was the ability to allow the user to change their password across the system's multiple files. Without some custom functionality, changing the password for a user would mean manually navigating to each of a dozen files and performing the same operation for each one, which is quite a pain, especially for a security-conscious organization that requires the periodic chaning of passwords.

Fortunately, as with most other needs, FileMaker gives us all the tools we need to provide this to our users, and this article will demonstrate how I accomplished this goal while pointing out numerous techniques to make the code more readable and maintainable. The solution makes use of custom menus and (optionally) custom functions, so you'll need FileMaker Pro Advanced to implement it.

Read more: Changing Passwords Across FileMaker Files

Custom Function Rules

In the near future I plan to publish a few articles about some FileMaker custom function sets that are pretty complicated, on the same order of complexity as the AssignParams set I recently wrote about.

With that in mind, my custom functions follow a set of conventions that, rather than reiterate each time, I'll publish here and link to.

Read more: Custom Function Rules

FileMaking 12: Incremental Progress

Last time, we built the beginnings of a FileMaker database to track books. In this column we’ll build on this, providing some additional features that will be useful to us as the developers of this system. We’re going to touch on many of FileMaker’s features, including layouts, table occurrences, scripts, and custom functions.

If you didn’t participate in the tutorial last month, you can download the file we’ll begin with that was completed in that column.

Read more: FileMaking 12: Incremental Progress

Custom Function Namespace Experiment

After writing the blog post about funciton scripting, the original author of the technique, Alexander Zueiv, was kind enough to comment on the article. He mentioned the possible problem of script variable name conflicts, and I agree, and eventually I'll edit the technique to include name spaces for the script variable names used by the technique so that isn't an issue.

But that reminded me of another namespace area that I've been experimenting with. Over the years, FileMaker has added organization features to various object types within FileMaker. We can now include spearators and folders for scripts and layouts, and I hope that eventually we'll see similar organization features for fields and custom functions, perhaps even value lists.

Read more: Custom Function Namespace Experiment

Creating a Menu Bar App

So, after years of promising myself I would, I finally created a native Mac OS X app. It’s a simple tool that scratches an itch I had but couldn’t find an adequate existing program for. It’s called YourSleeper and all it does is allow the user to set a timer after which iTunes will pause playback. It also gives the user the ability to fade the volume slowly so that the sudden cut in volume won’t perhaps wake him up. So far, it does exactly what I needed and no more, but I do have ideas for expanding its features. I figured it was a good way to dip my toe in the Mac App Store before I get to a few other itch-scratching apps I have ideas for.

Read more: Creating a Menu Bar App

Christianity and Libertarianism

My wife and I originally wrote this article back around 1998 or so in response to an article that was published in Christianity Today that held the position that Libertarianism and Christianity were mutually exclusive. This wasn't before the Internet, but it was before you could link to just about every article that was currently being published, so I don't have a link to the original.

We wrote this to publicly disagree with that. The title of their original opinion piece was something like, "Libertarianism is not a Viable Christian Position," so we entitled ours "Libertarianism is the Only Viable Christian Position." We submitted the article to Christianity Today and Liberty magazine, but both declined to publish it.

Read more: Christianity and Libertarianism

FileMaking 11: Getting Relational

Getting Relational

FileMaker is described as a relational database. Most of us have at least an intuitive idea of what a database is. While we covered the relational aspect in some detail in the first column, we’re going to look more closely at its meaning here. Some of what will be presented here is theoretical, but it will have practical applications, and the only portions of relational theory that we’ll cover will be those directly applicable to FileMaker databases.

Read more: FileMaking 11: Getting Relational

Superman vs. Batman, Law vs. Justice

I sometimes find it interesting how one thought leads to others. I just finished watching The X-Files: I Want to Believe after going through the entire series for the first time. Afterwards I read a bit about it and found Roger Ebert's comparison of it to The Dark Knight with both having themes of morality. This lead me to thinking about my favorite superhero, Batman, which lead to the comparison of Batman and the most popular superhero, Superman.

Don't you find it interesting that these two archetypes were found so early in comic book history? Superman was created in 1938[1], Batman in '39[2], and are the first two superheroes to be created. Every superhero in the last 80 years is descended from these two. Yes, Batman is descended from Superman, but other than the fact that they're both superheroes who dress in costumes and fight the bad guys, there isn't much similarity between the two.

Read more: Superman vs. Batman, Law vs. Justice

FileMaking 9: FileMaker 8.5

FileMaker 8.5

This month we’ll take a break from the tutorials on scripting that we’ve been in the midst of, because FileMaker, Inc. has released a new version of their product, version 8.5. FileMaker Pro 8.5 is available for $299, or $99 to upgrade from FileMaker Pro 8. The Advanced version retails for $499 and is also a $99 upgrade from Advanced 8. In addition to now being a universal binary for PowerPC and Intel Macs, a number of new features have been included.

Read more: FileMaking 9: FileMaker 8.5

RIP 17" MacBook Pro?

Well, I'm glad I have one and am happy with it, but it appears that Apple is discontinuing the 17" MacBook Pro. I suppose I understand. I can't have been their big seller, and with the introduction of the Retina 15" MacBook Pro, which has more pixels than my current 17", perhaps it will do down the road when I upgrade, but not having the option for a Retina 17" will hurt when the time comes.

Read more: RIP 17" MacBook Pro?

FileMaking 10: FileMaker 9

FileMaker 9

Although our last article covered FileMaker 8.5, in that lengthy interim, a new version of FileMaker has been released, pushing the version number up to 9.

FileMaker Pro 9 is available for $299, or $179 to upgrade from FileMaker Pro 7 or higher. The Advanced version retails for $499, and is a $299 upgrade from FileMaker Pro 7, FileMaker Developer 7 or FileMaker Pro Advanced 8 or above.

I’ll begin with those features aimed mostly at the novice database user and move gradually toward the more complex features aimed at the developer. The summary can be given in advance, however: while the list of feature additions in FileMaker Pro 9 is long, it’s also shallow, and while all are welcome, none seem critical. I’ll include everything new, with a brief description and comment.

Read more: FileMaking 10: FileMaker 9

FileMaking 1: Welcome to FileMaker

Here's the first article in a series I wrote for About This Particular Macintosh. The series was aimed at novice FileMaker users and took a tutorial format. There were 12 articles in the series, and I plan to continue with additional articles after I've republished the existing ones.

Welcome to FileMaker

FileMaker is a very popular database management applicaiton. There are a number of reasons for its popularity, but two of them that stand out are its relative ease of use and its power. I first began using FileMaker back in 1994 when I worked as an IS director for an LA advertising agency. I needed to track the purchase orders I submitted to vendors. I created a database in less than an hour that I continued to use for the two years I worked there, and it did everything I needed. On the other hand, FileMaker is powerful enough to create complete applicaitons that can track all of the information a business or corporate department needs, and I've built quite a few of those over the years.

Read more: FileMaking 1: Welcome to FileMaker

FileMaker Custom Function Uses

It’s been almost 10 years since the release of FileMaker 7, and with it, the introduction of custom functions to the developer arsenal. Over the last year or so, I’ve been making ever greater use of this feature, and thought that perhaps sharing the uses I make of custom functions might prove educational to others.

Read more: FileMaker Custom Function Uses

Improving iBooks

Before I bought an iPad, able to finally justify it because I had a client who wanted me to write software for it, I didn’t really understand the need for one. I’ve been using a laptop as my only computer for at least 14 years or so, and with the iPhone to provide even more portable computing, I felt like the iPad didn’t really offer anything that I didn’t already have. For major computing tasks I had my laptop, and the iPhone was seemed perfect for reading books in iBooks or websites with Instapaper.

When I first bought the iPad, it was solely for work. The only app I installed was FileMaker Go so that I could test the software I was writing. Soon, of course, I began to look at other apps, first iBooks and Instpaper, but eventually games and other productivity software such as OmniFocus. Now my iPhone has been relegated to a, well, phone (ok, and camera for stills and video, and audio player for music and podcasts). Nearly all my reading is now done on the iPad, whether its a web site in Safari, a book in iBooks or an article in Instapaper.

In fact, I’m reading more now than ever before, and most of the reading is done with iBooks on the iPad. I use it to reference design documents in PDF that I’ve written for clients, read classics downloaded from Project Gutenberg, But one unfortunate side effect of using iBooks ever more and more is coming to terms with the limitaitons of managing books using iBooks and iTunes.

Read more: Improving iBooks

FileMaker 12.0v4

An updater to version 12.0v4 of FileMaker was released today, and even though the installation notes say otherwise, the updater seems to work for both FileMaker Pro and FileMaker Pro Advanced with a single run, which is quite nice. For quite some time I've kept FileMaker Pro and FileMaker Pro Advanced on my machine. I tend to work with Advanced on a day-to-day basis, but find it occassionally useful to be able to open files in FileMaker Pro.

When an updater came out in the past, the process of updating both versions required that I run the updater twice, either manually selecting the version to update when queried by the updater software or by zipping up one of them and then the other, hiding it from the updater software. It was pleasantly suprising to find neither of those extra steps necessary this time.

So, thank you, FileMaker, Inc., for making my life just a tiny bit easier today.

Multiple FileMaker Script Parameters

This was never an original article, but a comment I made to Matt Petrowski’s screencast about function scripting in FileMaker.

I won’t cover the details (see the FileMaker help for that), but basically the problem being solved here is that while FileMaker scripts can accept a parameter, it’s only a single parameter, and often it would be very useful to pass multiple parameters to a script. An example I often use would be sending a record type and record id to a script that deletes a record.

Read more: Multiple FileMaker Script Parameters

Roll Your Own 2: Variables and Data

Originally published in June, 2002.

Variables and Data

Welcome back to Roll Your Own as we continue our journey into the magical world of Macintosh programming. Last month we covered the basics of what programming is and even dove right in and wrote a small program in AppleScript. In this edition of the column, we’re going to delve into one of the most useful programming tools: variables. And since variables store data, we’re also going to talk about data types.

Read more: Roll Your Own 2: Variables and Data

Resizing Your Options

This article goes back quite a ways for me. I originally wrote it in 2000 for FileMaker Magazine when that publication wasn't even on the web, but distributed its articles via a FielMaker database. Honestly, most of the information here is now obsolete, as the limitations of FileMaker's Show Custom Message that I outline have been removed since FileMaker 4, which was the current version when I wrote this.

However, in the interest of continual archiving and assured publication of my articles here it is. Currently you can still find the original article online.

Unfortunately, I can't yet find the technique file that originally accompanied this article. If I do, I'll be sure to edit this to include a link to it.

Read more: Resizing Your Options

FileMaking 8: Script Parameters and Results

Originally published in July, 2006.

Script Parameters and Results

Welcome back to FileMaking. This month, we’re going to continue our investigations of FileMaker’s scripting capabilities that we began last month. Now we’ll take a look at two features of ScriptMaker that were introduced in recent versions of FileMaker.

Most programming languages have a construct that is very similar to FileMaker scripts. These are known as subroutines, methods, or handlers, depending on the language one is programming in. Regardless of the name, most languages have a feature that comes with these subroutines: information can be passed to the subroutine when it’s called and information can be retrieved from the subroutine (in which case it’s often then called a function). When information is given to a subroutine, the information is called a parameter or argument. The information returned by a function is the result. Parameters and results make subroutines much more powerful. Rather than simply executing code, the routine can make complex decisions and behave very differently depending on the parameters passed, and once the subroutine is finished executing, it can communicate back to the calling program what it has accomplished.

Read more: FileMaking 8: Script Parameters and Results

What I Use

Along with the older articles that I'll be republishing here, I'll be writing new articles. A popular geek passtime seems to be publishing the tools one uses. I've been listening to the Mac Power Users podcast lately (almost caught up to current episodes) and a regular feature they have covers the workflows of prominent Mac users. David Sparks, one of the hosts of the podcast, does something similar on his blog by showing screenshots of iPad and iPhone home screens.

So, in the same vein, here's what I use, both hardware and software.

Read more: What I Use

Roll Your Own 1: The Ultimate Customization

Originally published in May 2002.

The Ultimate Customization

Hi there! Welcome to the first of what will be a series of articles on the ultimate customization of your Macintosh. I’m not talking about some slew of utilities that will allow you to change the look and feel of the Mac OS, nor am I speaking of which paints to use when giving that plain beige G3 a camouflage look; I’m talking about programming. If you’re like most people, the software you use on your computer was written by someone else. This column will take you through the process of “rolling your own” software instead of buying it off the shelf or from a catalog. There is no more powerful way to customize your computer’s capabilities than to write your own software.

Read more: Roll Your Own 1: The Ultimate Customization

Running Classic Software on an Intel Mac

Over the years I've written dozens of articles for various publications. Over the next few weeks I'll be republishing them here for a number of reasons: it's an easy way for me to get some content on this new site and I want to make sure that the articles remain available regardless of the state of the original publication site. For example, this article was originally published on About This Particular Macintosh back in September 2006, but that magazine has ceased publication.

It seemed to be a popular article both at the time and since its original publication, so here it is again, and I hope there are a few people who find it useful. Given how old it is, perhaps I'll do an update in the near future. As long as it remains up, the original (with comments by readers) is here.

Read more: Running Classic Software on an Intel Mac

FileMaking 7: "Real" Programming with FileMaker

Originally published in June, 2006.

“Real” Programming with FileMaker

Welcome back to FileMaking, where this month we’ll take a look at scripting in FileMaker, which allows you to turn a FileMaker database into a FileMaker application.

FileMaker can be used on two levels: first, it’s a simple database management system. You define tables, fields, and relationships, and FileMaker provides a structured way to store and retrieve data. Even though I’ve created some very large and complex systems with FileMaker, I have often used it in this manner to create simple databases that are basically glorified list managers, such as the Serial Numbers database we’ve worked on in past columns. Used in this mode, manipulating data in the database is a matter of using FileMaker’s built-in interface elements, such as Command-N to create a new record, View ‣ Find Mode to search for records, etc. FileMaker is very useful at this level. Anyone can create a simple database with a couple of tables and a few fields and begin storing data in it within minutes. Here is an example of a simple database like this:

Read more: FileMaking 7: "Real" Programming with FileMaker

Hello World!

I watched a video interview with Instapaper creator and Tumblr founder Marco Arment yesterday, and among other interesting comments was something to the effect that he created Tumblr in part because most people in technology at the time has created and abandoned a blog.

I fall into that category. Probably five years ago or so I started a blog called something like "Code Comments". I don't even know where it went, honestly. I was probably hosting it on Dreamhost with the rest of my sites, but it didn't go very far.

So here's my second attempt. I used to get my writing done by publishing to About This Particular Macintosh, but that magazine has ceased publication, and there's still quite a few things I'd like to get down that I hope others will find interesting. And that's what this will be for. I'll put AppleScript and FileMaker tutorials, software reviews (Mac and iOS, I stay as far from Windows as I can), and whatever else catches my fancy.

This is new, and I've no idea if I'll have any readers. Joomla, the content management system I'm using for this, doesn't have a built-in commenting feature for the blog, but I'll find an extension that does the job. In the meantime, you can email me with any comments or criticisms. I'll also look into seeing if Joomla can get a contact form on the page more easily than a comments feature.

FileMaking 6: Text Parsing with FileMaker

Originally published in May 2006

Text Parsing With FileMaker

Pardon my extended absence from this column. Life just has a way of getting away from one at times, and the work load piles up. But hopefully I’m back to a normal schedule again.

As mentioned in the last column I wrote regarding the direction of this tutorial series, we’ll now cover some basic text parsing functions. For beginning FileMakers, parsing text is one of the most useful skills to have as well as one of the first that questions are asked about.

Read more: FileMaking 6: Text Parsing with FileMaker