Home | About MACC | Clients | DADI | FMP Tutorial | MacFantastique

FileMaker Pro Session 3
Using the Sort Command Sorting Your Data

Using the SORT Command

  • Sorting lets you arrange (order, rank) records by selected criteria (such as alphabetically, numerically, or chronologically) forwards or backwards. mode... sort...

About Sorting Records

  • FileMaker Pro stores records in the order in which you add them to the database file called the default order. You can sort records to temporarily rearrange them based on entries in a field or a set of fields. This ias called the current sort.
  • You can sort on several fields at once. The first field you select arranges the records based on the field's contents. The second sort arranges records when two or more records have the same value. You can sort records in ascending order, descending order, or a custom order based on a field's value list.
  • FileMaker Pro keeps the records in the sorted order unless you unsort them or search or perform a find request.
  • FMP 3-4-5-6:
  • fm5sort
  • fm7 sort
  • sort fm7

Ascending vs. Descending Sorts

  • In an ascending sort your database ranks your data from A to Z, 1 to 10, etc. A descending sort is just the opposite and ranks your data from Z to A, 10 to 1, etc..
  • Creating a Sort Order & Sorting Records
  • Sorting records temporarily reorders them in the database file so you can browse, update, export or print records in a different sequence.

To create a sort order and sort records:

  1. Find the records you want to sort.
  2. Choose Sort from the Mode menu.
  3. In the Sort Records dialog box, choose a sort order.
  4. Select the fields you want to sort by and set sorting options.
  5. Click Sort.

To cancel a sort before it is finished: Press Command-period.

Tip: To sort by a container field: Create a text or number field that describes or identifies the contents of the container field. Then sort by that field.

To create a script with a sort order: Define the sort order, and then click Done (not Sort). Then define the script.

In FMP7 you ca specify the sort order:

define sort

Note: If you add a record after a sort, FileMaker Pro tries to maintain the sort order. The message in the status area changes to Semi-sorted to show that records are sorted approximately in order.

Sorting Various Field Types

  • Text: When a text field contains numbers, letters, and other characters, special rules apply. The numbers come before the letters and the special characters come before the numbers.
  • Warning: In a text sort, "111 Sacramento Ave." will come before "2 Telegraph Ave." even though 111 is not less than 2. This is because the computer looks at the first characters and decides that "1" comes before "2."
  • The other field types (number, time, date) are sorted as one would expect.
  • Multiple Level Sorting (Levels of Sorting)
  • We can have as many levels of sorting as we wish. Your database ranks your data on more than one field. This allows you to rank your data on more than one field and find records more easily. Traditionally, two or three is the most you would ever do. You might sort by company first, and then by last name.
  • You might have your customer file sorted by zip code, and within each zip code, by the customer’s last name, and within each last name, by first name.
  • Sort (Script Step)
  • Sorts the records in the current found set according to specified criteria. Find the records you want to sort (using Perform Find [ ] or Find All) before using the Sort script step. If you sort a repeating field, FileMaker Pro sorts on only the first entry in that field. You don't need to use the Enter Browse Mode or Go to Record/Request/Page (First) script steps after using Sort.
  • You can store one set of sort instructions for each sort script. To use more than one set of sort instructions within a single script, make several one-step scripts for each sort and use them as subscripts with Perform Script.
  • In FMP 7 just specify the script step inside a set of conditionals
  • Sort in a custom order, according to the order of values in a value list (for example, in the order months are arranged)

In the fields list, select a field, select Custom order based on value list, then choose or define a value list. (See information about defining a list of values for data entry.)

Records with values not in the specified value list will be sorted alphabetically at the end.

Options

  • Restore sort order tells FileMaker Pro to use the sort order in effect when the script was created (stored settings). When Restore sort order is not selected, FileMaker Pro uses the most recently executed sort instructions.
  • Perform without dialog inhibits the display of a dialog box when the script step is performed. Deselect this option to show a dialog box so the user can enter a different set of sort instructions when the script step is performed. Select Perform without dialog to prevent the user from changing the sort instructions.

  next - Updated Sunday, December 12, 2004


Jump Menu

 

Sunday, March 6, 2005