People Goal 5 - Part 2: Sort your main list layout

Document created by Kedar on Feb 4, 2015Last modified by communitymanager on May 12, 2015
Version 12Show Document
  • View in full screen mode

 


In Goal 2, you added a subsummary part to your Main List layout, but it doesn’t display unless you sort the data by the Last Initial field. Let’s create a script to store the sort settings so that it's easier to perform.

 

 

Goal:


Create a one-line script that sorts your main table records, causing the subsummary part of your Main List layout to be displayed.

 

 

Steps:

 

Create the script

 

  1. Make sure you are viewing your Main List layout in Browse mode.

    In the example file, this layout is called “Contact List”.


  2. Choose the Scripts menu > Script Workspace…  ⇧⌘S or Ctrl S

    A
    Script Workspace window appears.


  1. Create a new script by clicking the + button above the left panel, or by pressing Command-N (OS X) or Control+N (Windows).

    Note that the bug button on the right only appears in FileMaker Pro Advanced.
    create new script button.png

    Your new script appears in the center pane of the Script Workspace. It is currently named "New Script" but FileMaker Pro is waiting for you to rename it.
    new script in center pane.png
  2. Name your script: Sort [Main Tablename], then press Enter to save the change.

    The example solution calls this script “Sort Contacts”.

  3. In the progressive search box of the right pane, type: sort

    Two script steps have the word "sort" in their name, so they are displayed.
    right pane sort records.png
  4. Double-click the Sort Records script step in the right pane.

    The script step appears in your script in the center pane.


  5. Click the blue gear to specify the script step options.

    A popover appears.
    sort records options.png

  6. Select the Perform without dialog option.

    Normally, a dialog window is displayed asking the user how the records should be sorted. When this option is selected, this dialog window is suppressed.

  7. Select the Specify sort order option.

    A Sort Records dialog window appears.

  8. Move the “Last Initial” field from the fields on the left to the Sort Order list on the right.

  9. Repeat step 10 for the “Full Name” field.

  10. Click the OK button to dismiss the Sort Records dialog window.

  11. Close your script by  Edit Script… window by clicking on the X that appears when you hover over the script name.
    close the open script.png

    A dialog window appears asking “Save changes to ‘Sort Contacts’ first?”

  12. Click the Save button to save your changes.

    The dialog box disappears and the script disappears from the center pane.



Test the script


  1. Choose the Records menu > Unsort

    The records are returned to their original unsorted state and the subsummary part disappears. If this menu command is grayed out, the records are already in this state.

  2. In the left pane of the Script Workspace, select the “Sort Contacts” script.

  3. Click the "Run" button above the left pane of the Script Workspace.
    run current script button.png

    The script runs. Your found set should now be sorted, causing the subsummary part to display the last initial headings.

     

      

Attachments

    Outcomes