Sorting On Multiple Fields

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

As you probably know (or at least suspected), you can sort a set of FileMaker records by more than one field. Each of these fields can have their own sort field settings such as ascending or descending. The first specified sort will take place and then any duplicates in that sort order will be sorted by the following order ( and so on for as many sort orders that you have in the sort operation).


In this example, we performed a multiple field sort by adding the following fields to the sort order and setting their options appropriate to our needs.

Market field ( ascending )
State field ( descending )
Company Name ( ascending ).

So here is what we get when we click the following fields...

SORT COMPANY
ABC Company IL Shoes
ABC Company CA Shoes
ABC Company CA Backpacks
LMN Company TX Shoes
LMN Company TX Handbags
LMN Company NY Shoes
LMN Company NY Backpacks
TRU Company IL Handbags
TRU Company CA Handbags
XYC Company TX Shoes
XYC Company NY Backpacks

SORT STATE
TRU Company CA Handbags
ABC Company CA Shoes
ABC Company CA Backpacks
ABC Company IL Shoes
TRU Company IL Handbags
LMN Company NY Shoes
LMN Company NY Backpacks
XYC Company NY Backpacks
XYC Company TX Shoes
LMN Company TX Shoes
LMN Company TX Handbags

SORT MULTIPLE FIELDS
LMN Company NY Backpacks
XYC Company NY Backpacks
ABC Company CA Backpacks
LMN Company TX Handbags
TRU Company IL Handbags
TRU Company CA Handbags
LMN Company TX Shoes
XYC Company TX Shoes
LMN Company NY Shoes
ABC Company IL Shoes
ABC Company CA Shoes

An example file can be downloaded by clicking (here)

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