Thank you for visiting the FileMaker Calculations Explored blog. I recently moved this content over from my blogger account. Hope you like it! When you get a chance, check out the centralized search feature for all the FileMaker blogs found along the right side panel. It is quite handy!

Sunday
Apr262009

FILEMAKER: Number Functions And Negative Values

From Dwayne Wright - Certified FileMaker 9 Developer
WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright

CHAPTER 09: Number Functions

Working with number functions are pretty straight forward until you start working with negative values. Using the negative number of - 189.12548, the following functions (ABS, Round, Truncate, Floor, Ceiling and Integer) return what value and why? What if we use a negative value in the second parameter (where available) to determine the direction from the decimal point?

------------
Abs ( - 189.12548 ) returns 189.12548
The Abs is short for absolute and always returns a positive number. Commonly used to know the difference between two values without knowing which is greater.

This is pretty simple to figure out.

------------
Round ( - 189.12548; 2 ) returns -189.13
Round ( - 189.12548; -2 ) returns -200

A function commonly used to round a number to a specified number of decimal places in the second part of the functions parameter. The specified rounding space takes numbers below 5 and rounds them downward. Numbers equal to or above 5 are rounded upward.

Again, this one is pretty straight forward. Round ( numberToEvaluate; 2 ) returns -189.13 because we are going two deep to the right of the decimal point and rounding the 5 digit upward. Round ( numberToEvaluate; -2 ) returns -200 because we are going two places to the left of the decimal point and rounding the 8 upward.

------------
Truncate ( - 189.12548; 2 ) returns -189.12
Truncate ( - 189.12548; -2 ) returns -100

Truncate gives you a number that is cut off to a number of decimal places that you specify. This doesn't do any rounding but simply a cutoff point. Truncating with a negative precision will take you to the right of the decimal point.

Again, this one is pretty straight forward. Truncate ( numberToEvaluate; 2 ) returns -189.12 because we are going two deep to the right of the decimal point and stopping. Truncate ( numberToEvaluate; -2 ) returns -100 because we are going two places to the left of the decimal point and stopping.

------------
Floor ( - 189.12548 ) returns -190

The floor function returns a number rounded down to it's next closest integer value.

Now this one could possibly throw you because you may automatically think -189 is the answer. This is because mentally we don’t work with negative numbers that much and we think 189 is lower than 190. However, in a negative number situation, -190 is less than -189. Some others get confused because they think floor means zero and it does not.

------------
Ceiling ( -189.12548 ) returns -189

Ceiling will return a number rounded up to the next integer value.

Learning how Floor reacted to a negative value prepares you for how Ceiling will handle it.

------------
Int ( -189.12548 ) returns -189

This function is used to return a whole number for a given number or field, however it does not perform this by rounding. For instance, the integer value for the number 5.3 would return as 5 and the integer value for the number 5.7 would return as 5

Here are some links to other posts that might be of interest in regards to this topic...
EXAMPLE: Number Functions

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

© 2009 - 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.

ADVERTISEMENT ==================
MacUSA provides website and FileMaker Pro hosting services. Utilizing the highest performance web and FileMaker servers. We make FileMaker database hosting as simple as possible. Mac USA Technical Support has been voted the best by our customers. FileMaker Server hosting for your FileMaker web hosting needs supporting FileMaker 10 down through version 5. Hosting FileMaker Pro databases for Instant Web Publishing and Custom Web Publishing including PHP, XML, ODBC, and MySQL access. Use Promo Code dw0904F for FREE setup (a $25 value) when signing up for your FileMaker Hosting services. Offer expires 6/30/2009. http://macusa.net

Friday
Apr172009

FILEMAKER: Payment Processing Plugins Comparison Link

From Dwayne Wright - Certified FileMaker 9 Developer
WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright

CHAPTER 21: External Functions

An interesting comparison chart of payment processing plug-ins has been posted by the good folks of filemaker-plugins.net that appears to be based upon the work done by Application Architects. This is a straight comparison charts of listed features for each compared side by side.

Although I like the effort here, I’d love it if someone picked up the ball and took the next logical step. That would be to write an editorial comparison. That would be a heck of a lot of work but I’m sure it would be welcomed by the FileMaker community at large. In particular the company decision makers that might not have significant FileMaker geek kung fu at their disposal.

Here is the link ...

http://filemaker-plugins.net/compare/payment-processing-plugins/

© 2010 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. FileMaker Pro is the registered trademark of FileMaker Inc.

Sunday
Mar152009

LINK: Great Description Of FileMaker Function Recursion In Action

I recently discovered the FileMaker Inspiration blog and wanted to link to an article they produced in October 2008 in regards to scripted global search and replace. I’m not sure I would ever use the technique as described (and not sure that I wouldn’t) but the description of recursive custom function action is excellent! The metaphor of a needle and a haystack is great method to help visualize the process!

The link is below ...

http://filemakerinspirations.com/2008/10/filemaker-pro-custom-function-global-search-and-replace/

© 2010 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. FileMaker Pro is the registered trademark of FileMaker Inc.

Wednesday
Mar042009

FILEMAKER: The Calculation Literal Explored

From Dwayne Wright - Certified FileMaker 9 Developer
WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright

CHAPTER 04: Calculation Basics

A calculation literal is a value within a calculation that does not change and has been entered in by the developer. A calculation literal, an expression and a reference value are the three ways you can supply a parameter to a FileMaker function.


Many times a calculation literal is used when you are placing a string of characters in a calculation saved as a test result. A literal text string within a calculation needs to be enclosed between quotation marks. For example say that you have a person name field and a birth date field and you wanted to make a calculation field return a birthday message. The calculation could be something like Person Name & “ birthday is “ & Birth date.

You can also define literal numbers or literal date strings. Literal number values do not have to be enclosed within quotes. A literal date value would need to be enclosed within quotes and be wrapped within a GetAsDate function.

Since calculations can be used in scripting, you can have a calculation literal supply the user a reference point. The Go To Layout script step for example could have a number of literal references. One example could be to go to a list view layout if the results of the search yields more than one found record or go to form view if just one matching record is found.

Case(
Get ( FoundCount ) = 1 and Get ( LayoutTableName ) = "Campaign"; "FORM_Campaign";
Get ( FoundCount ) > 1 and Get ( LayoutTableName ) = "Campaign"; "LIST_Campaign";
Get ( FoundCount ) = 1 and Get ( LayoutTableName ) = "Client"; "FORM_clients";
Get ( FoundCount ) > 1 and Get ( LayoutTableName ) = "Client"; "LIST_clients";
etc...
"")

As with most literal references, you can encounter problems if you change the name of the reference. You notice that I use a singular reference for the Campaign module but a plural reference for the clients module ( FORM_Campaign vs FORM_clients ). This type of mismatched naming convention is something you would want to avoid or fix. It doesn’t hurt the results actually but is an example of sloppy design. If I decided to rename all my layouts singular or rename them all plural, I would have to redo my calculation to bypass any errors!

© 2010 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. FileMaker Pro is the registered trademark of FileMaker Inc.

Saturday
Feb072009

FILEMAKER: Arguments Explored

From Dwayne Wright - Certified FileMaker 9 Developer
WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright

CHAPTER 05: Function Basics

An argument is a piece of needed information (otherwise known as input) in a function. So your typical function will have a name and an argument for the input value(s). When there are multiple input values, FileMaker will place some placeholder text in these areas and these areas are called parameters. The structure of the argument and the data you pass to it, act as the wrapper for what the function is going to do.

LeftWords ( text ; numberOfWords )

Here the function name is LeftWords. The argument is text ; numberOfWords (because this is the data needed for the function to perform). This function is made up of two parameters separated by the semicolon. Semicolons are used to separate one parameter from another. Semicolons are a soft boundary between multiple parameters. These parameters placeholders can be replaced with field names, literal text or a variable. You can place another function into one (or more) of the parameter place holders to have one function nested within another one.

FYI ... LeftWords is a function that can return a specified number of words from the left of a field or string of text. For example... LeftWords(LeSaux Media Service, 2) would return a text result of LeSaux Media. This is because I asked for the left 2 words of the string LeSaux Media Services.

FYI ... Variables can be created and used in scripts and calculations. Variables are useful in simplifying complex calculations, passing information from one process to another and opening doors to innovation within FileMaker design.

FYI ... Before FileMaker 7, commas were used to separate one parameter from another. You can still type in a comma and FileMaker will turn those commas to semicolons when you close the calculation dialog box.

© 2010 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. FileMaker Pro is the registered trademark of FileMaker Inc.