Defensive coding with literal references

Wow, if that isn't a mouthful! "Defensive coding with literal references". This likely wasn't even on your FileMaker radar. In fact, FileMaker takes care of so many things for you, it's easy to think your FileMaker solution will just run forever. Funny thing is, there still are FileMaker 5/6 solutions running to this day - I've seen them!

In the days prior to the .fp7 file format, it was actually quite hard to create your own solution errors outside of the possible errors which FileMaker already accounts for. Unless, it was something silly like deleting a layout entirely when it was used by multiple scripts.

However, with today's more powerful FileMaker, you can certainly create a solution which will break in a heartbeat. As you add more and more complexity, you also increase the potential for things that may break. Here's what I mean. You use a Go To Layout [] script step, and you select the option to go to a layout by name - via calculation code. You input the name of your layout as "Customer list". Three months down the road you rename that layout to "Customer filter list" because it now more appropriately identifies its application.

Guess what broke? Your code! While this example is likely easy to track down and fix, it's even better to build in some preventative checking for these types of situations. That's exactly what this video is about. Using a dedicated technique for making sure your literal references can be more easily fixed when, and if, they break.

The easiest fix is to catch the issue before you release or set up some type of notification. Here are just a few of the ways you can cause yourself some headaches using literal references.

  • Go to Layout [ "some layout" ]
  • Go to Object [ Object Name: "some object" ]
  • Set Field By Name [ "literal field"; "some value" ]
  • Select Window [ Name: "some window name"; Current file ]

These script steps all provide possible literal references, and you want to make sure you won't get in trouble with them! Fortunately, I have a great solution!

AttachmentSize
DefensiveCoding.zip231.82 KB