Fundamental FileMaker Portal Sort Via Calculation

From Dwayne Wright PMP
Certified FileMaker Developer

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

Please Note: If you are viewing this page in a news feeder, the images may get munged up a bit. For the best experience, please visit the journal directly by clicking (here). 

This is a very simple example of sorting a portal by using a calculation field that leverages the power of the CASE function. This is a very fundamental method and I should note that there are many other methods that have greater power and flexibility.

BTW: The Case function is a streamlined version of a nested IF statement that evaluates an expression and if true uses the posted result, otherwise it goes to the next expression to evaluate.  FileMaker will evaluate each case step from the top going down and the first condition that is TRUE, will be the final result. This is something to remember when building your CASE function. If you have them in the wrong order, you might get a result you didn’t expect.

 

The calculation is simply...

Case(
Global Filter Field = "Sort Name", Name,
Global Filter Field = "Sort Zip", Zip,
Global Filter Field = "Sort Phone", Phone,
Global Filter Field = "Do Not Sort", "",
"")

with a text result. We put the Global Filter Field on the layout and made it a radio button value list. When you make a selection and exit the record, the portal sort for you. We added a button on the layout with the name of sort. This button doesn't do anything such as running a script. However by clicking the button, you exit the record and you will trigger the screen refresh.

An example file can be downloaded by clicking (here).
=
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.