Search Project Mgmt
Search FileMaker Blogs
Thursday
Jun042015

The Format Of FileMaker Calculation

From Dwayne Wright PMP, PMI-PBA, PMI-ACP, CSM
Certified FileMaker Developer

WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

In the FileMaker calculation dialog box, most users will have a point and shoot design mentality. It goes something like this...

- there is that thing I want to add to my calculation
- I have selected that thing by clicking once upon it (point)
- I double click that thing to add it in my calculation dialog box (shoot)
- I see my selection appear in the text area as text
- I edit the text string as need, perhaps even by pointing and shooting other things.

Very few of you, simply type what you need into the dialog box, because you are familiar with the syntax of the calculation you want to use. This reduces the time to enter a calculation and is a much easier transition to calculation documentation. Hugh, what documentation? You can type text into a calculation work area that is for comments only. You just have to proceed or end that string of text with a flag. Anyway, when you type in your calculation without using any of FileMaker’s helper buttons/menus, you can quickly type in comments to refer to later (if/when) you or another developer has to edit that calculation.

Anyway .... how about we start talking about calculation formatting?

A calculation in FileMaker has to be formatted correctly to get expected results. It is not that hard to do and it may be second nature to you. The calculation test format is familiar because FileMaker calculation formats are basically the same as regular mathematic formula formats.

To have a successful calculation, you need to determine what result you want to get and in what format (text, number, date, time, timestamp or container). Next you need to enter in the calculation itself and this is normally called the calculation expression.

As a general rule, the calculation expression is read from left to right. So a calculation of 2 + 2 * 4 would be calculated as two plus two and then that result is multiplied by four. So our returned value would be 16. This is because two plus two equals four and four multiplied by four equals sixteen.

Now we need to chat about parenthesized expressions or those calculations that are within a left and right parenthesis. Parenthesized expressions are calculated first and then the calculation goes back to reading from left to right. So a calculation of 2 + (2 * 4) would be calculated with the parenthesized expression first ( 2 * 4) and then that result is added by two. So our returned value would be 10. This is because two multiplied by four equals eight. The we go to the left of the calculation and add two, which of course is 2 + 8.

In following discussions, I will chat about the formatting of FileMaker functions. The format of a calculation can still take a turn when we start discussion operators. Then I will chat still later on ways to format complex calculations with multiple functions, multiple operators and parenthesized expressions to be easily read.

However when it is all said and done, your first and primary control over a calculation is the use of left and right parenthesis around expressions.

=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2007 - Dwayne Wright - dwaynewright.com

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.
Commenting Disabled
Due to a very high level of spam, I've disabled commenting.