Build-On Tutorial:


Staff: Lesson 1

Staff List

Lesson Overview

The objective of this build-on is to add functionality for tracking staff who are related to events and sessions. You will create the tables, fields, relationships, scripts, and interface elements necessary to do this.

In this lesson, you will create a table and fields for tracking staff information, a layout, a script, and buttons for getting to and from a staff list.

Here’s a sneak peek of what you will build:

Step 1 - Create the table and fields

Create the new Staff table by duplicating the existing Template table.

  1. Open the Manage Database dialog by using the File > Manage > Database… menu item.

    Note: You can also open the Manage Database dialog by entering Layout mode and clicking the Manage button or by using the keyboard shortcut Shift-Command-D (macOS) / Shift-Control-D (Windows).
  2. Choose the Tables tab to view the list of existing tables.
  1. Duplicate the Template table by selecting it in the list, clicking the Copy button, and then clicking the Paste button.

    Note: You can also use the standard copy and paste keyboard shortcuts.
  2. The new table will be named Template 2 by default. Rename the Table to “Staff" using the Table Name field and then click the Change button.
  1. Double-click on the Staff table to switch to the Fields tab and view the fields in that table.
  2. Add the following fields to the Staff table:


      1. Address_City (text)
      2. Address_State (text)
      3. Address_Street (text)
      4. Address_Zip (text)
      5. Email (text)
      6. Name_First (text)
      7. Name_Last (text)
      8. Name_First_Last (calculation formula: Name_First & " " & Name_Last; calculation
        result is Text)
      9. Name_Last_First (calculation formula: Name_Last & ", " & Name_First; calculation
        result is Text)
      10. Organization (text)
      11. Phone (text)
      12. Photo (container)
      13. Staff_Notes (text)
      14. Staff_Status (text, auto-enter calculation: Select Options…; in the Auto-Enter tab
        check Calculated Value, and in the Specify Calculation dialog, add “Active”. Check Do not replace existing value of field (if any)).
      15. Title (text)

Step 2 - Modify Relationships graph

Next, you will update the Relationships Graph.

  1. You should still be in the Manage Database dialog after completing step 1. If not, re-open the Manage Database dialog.
  2. Activate the Relationships tab, find the newly created Staff table occurrence. Double-click on it to open the Specify Table dialog and change the name to “STAFF”. This is done for consistency with the graph organization techniques used in your app.
  1. Use the color tool at the bottom of the graph to change the color of the STAFF table occurrence to the same blue used elsewhere, and then move it to the bottom of the graph.
  1. Close the Manage Database dialog to save your work.

Step 3 - Rename and move layout

It’s a common practice to create special developer-only layouts for each table in a FileMaker app. Such layouts often contain all fields in the table and are helpful for developers to use in reviewing system data. They can also be used for scripted processes that find, create, or delete records. The Event Management Template contains a special Developer layout folder for organizing these layouts and each layout is named [Table Name] Utility.

Use the Manage Layouts dialog (File > Manage > Layouts…) to rename and organize the newly created STAFF layout for this purpose.

  1. Locate the new STAFF layout at the bottom of the list. Then open the Layout Setup dialog by double-clicking on the STAFF layout name, or selecting it and clicking the Edit button.  Rename it to “Staff Utility”.
  1. Back in the Manage Layouts dialog, drag the Staff Utility layout into the Developer folder, just below the Session Utility layout. Ensure that Include in layout menus is not checked.

Step 4 - Add Staff List layout

You will now create a new Staff List layout by duplicating and modifying the Attendee List layout.

  1. Return to the Manage Layouts dialog.
  2. Select the Desktop > Attendee > Attendee List layout in the list and Duplicate it.
  3. Open the Layout Setup dialog for the new layout and make the following changes: 
    1. Set the Layout Name to "Staff List".
    2. Set the Show records from: dropdown to the STAFF table occurrence. This setting determines the context of the layout.
  1. Back in the Manage Layouts dialog, use the dropdown arrow next to the New button at the bottom of the window to create a new folder named “Staff”. Then move the new Staff List layout into this folder.
  1. Close the Manage Layouts dialog.
  2. Enter Layout mode using the View > Layout Mode menu item, or the keyboard shortcut Command-L (macOS) / Control-L (Windows).

    Use the Layout pulldown menu in the status toolbar to navigate to the Desktop > Staff > Staff List layout.
  3. Double-click the Attendees text in the layout header and change the text to "Staff".
  1. Double-click the Name_First_Last field to open the Specify Field dialog.
    1. In the table drop-down, select Current Table (“STAFF”).
    2. In the field list, select Name_Last_First.
  1. Similarly, edit the Organization and Title fields to set them to the same version of those fields in Current Table (“STAFF”).
  2. Select and delete the # Events Attended label and the Count_Events_Registered field.
  3. Select and duplicate the label and field objects for Title by choosing Edit > Duplicate (or the keyboard shortcut Command-D (macOS) / Control-D (Windows)). Then edit them to display “Email” for the label and the STAFF::Email field.
  4. Resize and arrange the fields so they look similar to the image below.
  1. Double-click the Add Attendee button to open the Button Setup dialog, and rename it "Add Staff”. You will change the associated script in the next lesson.
  1. Enter Browse mode to save and review your work. You can do this in several ways:
    1. Click the Exit Layout button.
    2. Choose the View > Browse Mode menu item.
    3. Use the keyboard shortcut Command-B (macOS) / Control-B (Windows).

Step 5 - Add a script to go to the Staff layout

Next, you will create a script that will navigate to the Staff List layout. In the next lesson you will modify this script to go to either a list or detail view layout.

Note: If you have not worked with scripts before, you will find it helpful to review the Creating and Editing Scripts section of the FileMaker Pro Advanced Help system before starting this task.

  1. Open the Script Workspace (Scripts > Script Workspace...).
  2. Create a new subfolder within the DESKTOP UI folder named “STAFF". Exclude the folder from the scripts menu by unchecking the box on the left. (If the checkboxes are not displayed, click the Scripts menu management toggle button at the top of the screen, highlighted below.)
  1. Select the DESKTOP UI > ATTENDEE > Go to Attendee Layout ( view ) script and duplicate it (Scripts > Duplicate Script menu item, or the standard keyboard shortcut).
  2. Rename the new script "Go to Staff Layout ( view )” and move it into the folder you just created.

    Note: Any time you create a new script or copy an existing one, amend the comments at 
    the top to fit your current script.
  1. Modify the Purpose comment to indicate the script goes to a staff layout.

# Purpose:    Goes to the specified staff layout

  1. Modify the script so that it goes to the new Staff List layout and then sorts by last and first first name. The impacted script steps are highlighted below. You will further modify this script to go to a new Staff Detail layout in Lesson 2.

    NOTE: For more detail on the Sort Records step, see below.

Allow User Abort [ Off ]
Set Error Capture [ Off ]
Enter Browse Mode [ Pause: Off ]
Freeze Window

# load parameter(s) Set Variable [ $parameter_parsing_ok ; Value: #Assign ( Get ( ScriptParameter ) ) ]
If [ $parameter_parsing_ok = False ]
   # parameters could not be parsed, exit this script and report back
   Exit Script [ Text Result: "error" ]
Else If [ not IsEmpty ( $view ) and $view ≠ "list" and $view ≠ "detail" ]
   # invalid parameter(s) passed
   Show Custom Dialog [ “Error"; "Invalid parameter(s) passed to script: " & Get
( ScriptName ) ]
   Exit Script [ Text Result: "error" ]
End If

# close card window (if applicable)
If [ Get ( WindowStyle ) = 3 ]
   Perform Script [ Specified: From list ; “Close Window” ; Parameter: ]
End If

# layout nav
If [ $view = "list" ]
   # go to list layout
   Go to Layout [ “Staff List” (STAFF) ; Animation: None ]

  # show all and perform default sort (last name, first name)
   Show All Records
   Sort Records [ Restore ; With dialog: Off ]
   Go to Record/Request/Page [ First ]
   # go to detail layout
   Go to Layout [ “Attendee Detail” (ATTENDEE) ]
End If

Exit Script [ Text Result: $null ]

  1. For the Sort Records step, ensure With dialog is set to Off. Then double-click the script (or click the gear icon at right and choose Specify sort order) to open the Sort Records dialog. Add the following fields to the Sort Order:
    1. STAFF::Name_Last, ascending
    2. STAFF::Name_First, ascending

      Note: The Sort Order in the Sort Records dialog might look slightly different because the active layout determines the default context for the Sort step. So you may or may not see “STAFF::” before each field included in the sort.
  1. Save and close the script.

Step 6 - Add buttons to run the new script

Now that you have a script in place to take a user to the Staff List layout, it’s time to create buttons so that the user can initiate the action.

  1. Enter Layout mode and navigate to the Desktop > Dashboard layout.
  2. Duplicate the Sessions button.
  3. Double-click on the new button to open the Button Setup dialog.
    1. Set the button name to “Staff”.
    2. Select the icon indicated below.
    3. Modify the action to perform the new Go to Staff Layout ( view ) script. Note that the script parameter is set to the formula: # ( "view" ; "list" ). You do not need to modify this.

      Note: The # and #Assign custom functions are used to pass and parse parameters. The # custom function is generally used to define a script parameter and accepts a key-value pair; the #Assign custom function is called in the script and turns key-value pairs into script variables.
  1. Move the Staff button to the right of the Sessions button. Use the dynamic guides as you drag the button to vertically-center the button relative to the other buttons and match the button spacing.
  2. Select the four buttons (click and drag to select multiple items, or shift+click on each item) and move them to the left to center the group horizontally on the layout. Tip: Hold down the Shift key after you start dragging left to constrain the movement horizontally. Look for the dynamic guide to appear when the group objects is centered.
  1. Enter Browse mode to save and review your work.
  2. Next, enter Layout mode again and navigate to the Menu | Card layout.
  3. Double-click the Sessions button to open the Button Bar Setup dialog.
    1. Click the + button to add a new segment named “Staff”
    2. Set the button Action to Perform Script
    3. Set the script to Go to Staff Layout ( view )
    4. Set the parameter to the formula: # ( "view" ; "list" )
  1. Open the Inspector using the View > Inspector menu item. You can also access it using keyboard shortcut Command-I (macOS) / Control-I (Windows).
  2. Activate the Position tab of the Inspector.
  1. Select the button bar object, and using the Inspector, set the button bar’s Height to 200 pt.

    Note: If the units are currently displayed as in (inches) or cm (centimeters), click on a unit label repeatedly to toggle through the units until pt (points) is displayed.
  1. Enter Browse mode to save and review your work.

Step 7 - Review your work

  1. Navigate to the Dashboard layout and click the Staff button. You should see the Staff List layout with zero records.
  2. Navigate back to the Dashboard layout and click the Events button. Now click the navigation button (upper-right corner of the layout) and click the Staff button in the navigation pane. You should see the Staff List layout.