• Create BookmarkCreate Bookmark
• Create Note or TagCreate Note or Tag
• PrintPrint

### FileMaker Extra: Tips for Becoming a Calculation Master

As we mentioned at the outset of this chapter, it takes time to master the use of calculation formulas. We thought it would be helpful to compile a list of tips to help you get started on the path.

• Begin with a core— Don't try to memorize everything at once; chances are you'll end up frustrated. Instead, concentrate on building a small core of functions that you know inside and out and can use without having to look up the syntax or copy from examples. Then, gradually expand the core over time. As you have a need to use a new function, spend a few minutes reading about it or testing how it behaves in various conditions.

• Work it out on paper first— Before writing a complex formula, work through the logic with pencil and paper. This way you can separate the logic from the syntax. You'll also know what to test against and what to expect as output.

• Search for alternative methods of doing the same thing— It's uncommon to have only one way to approach a problem or only one formula that will suit a given need. As you write a formula, ask yourself how else you might be able to approach the problem, and what the pros and cons of each method would be. Try to avoid the “if your only tool is a hammer, than all your problems look like nails” situation. For instance, if you always use If statements for conditional tests, be adventurous and see whether you could use a Case statement instead.

• Strive for simplicity, elegance, and extensibility— As you expand your skills, you'll find that it becomes easy to come up with multiple approaches to a given problem. So how do you choose which to use? We suggest that simplicity, elegance, and extensibility are the criteria to judge by. All other things being equal, choose the formula that uses the fewest functions, has tightly reasoned logic, or can be extended to handle other scenarios or future needs most easily. This doesn't mean that the shortest formula is the best. The opposite of simplicity and elegance is what's often referred to as the “brute force” approach. There are certainly situations where that's the best approach, and you shouldn't hesitate to use such an approach when necessary. But if you want to become a calculation master, you'll need to have the ability to go beyond brute force approaches as well.

• Use comments and spacing— Part of what makes a formula elegant is that it's written in a way that's logical and transparent to other developers. There may come a time when someone else needs to take over development of one of your projects, or when you'll need to review a complex formula that you wrote years before. By commenting your formulas and adding white space within your formulas, it becomes easier to expand upon and troubleshoot problems in the future.

• Be inquisitive and know where to get the answer— As you write formulas, take time to digress and test hunches and learn new things. Whip up little sample files to see how something behaves in various conditions. Also, know what resources are available to you to get more information when you get stuck or need help. The Help system, the function reference found in Appendix B of this book, and online discussion groups are all examples of resources you should take advantage of.

PREVIEW

Not a subscriber?

Start A Free Trial

• Create BookmarkCreate Bookmark
• Create Note or TagCreate Note or Tag
• PrintPrint