Build-On Tutorial:

Committees

Committees: Lesson 1

Add and edit committees

Lesson Overview

The objective of this Build-On is to allow users to create and edit committee records. You will create a new table with fields for this purpose and new list and detail layouts. You will update the dashboard page and add navigation to committee list and detail layouts.

In Lessons 2 and 3 you will add assignments and update committee and member detail layouts to keep track of members assigned to a committee.

Step 1 - Add committee table and fields

Create a new table and fields for tracking committees.

  1. Open the Manage Database dialog (File > Manage > Database...) and activate the Tablestab.
  2. Duplicate the Template table by selecting it, then click Copy, then Paste, at the bottom of the dialog.
  3. Rename the new table to Committee and click Change.
  4. Double-click the Committee table to see the list of fields it contains.
  5. Create the following additional fields in the Committee table:
    1. Name (text)
    2. Status (text)
  6. Double-click the Status field. In the Options for Field dialog:
    1. In the Auto-Enter tab, click the Data checkbox.
    2. Type “Active” as the default status for a new committee.
    3. Click OK to close the options dialog.
  1. Switch to the Relationships tab of the Manage Database dialog. Note that a new table occurrence named Committee was automatically added to the graph when you created the new table.
  2. Double-click the Committee table occurrence and rename it to “COMMITTEE”. If it isn’t already on the left side of the graph, move it to the left in line with the other table occurrences on the left, to keep it organized. This is done for consistency with the graph organization techniques used in the file.
  3. Click on OK to save your changes and exit the Manage Database dialog.

Step 2 - Create committee list and detail layouts

Create new committee list and detail layouts by duplicating the existing Member List and Member Detail layouts.

  1. Open the Manage Layouts dialog (File > Manage > Layouts...).

    Note: You can also use the keyboard shortcut Command-Shift-L (macOS) / Control-Shift-L (Windows).
  2. Find the COMMITTEE layout, which was created automatically when you added the new table, and drag it to the Developer folder. Open the Layout Setup dialog by double-clicking on the COMMITTEE layout name, or selecting it and clicking the Edit button. Rename it to Committee_DEV. Ensure that Include in layout menus box to the left is not checked. Click OK to exit the Layout Setup dialog.
  3. Create a new layout folder: click the arrow next to the New button in the lower left corner and choose Folder... Name the new folder "Committee"
  1. Make the new Committee folder a subfolder of the Desktop folder by dragging it into place.
  1. Select both the Member List and Member Detail layouts and duplicate them by clicking the Duplicate button or by pressing Command-D (macOS) / Control-D (Windows).
  2. Drag both layouts to the Committee folder.
  1. Double-click the Member List Copy layout. In the Layout Setup dialog, do the following:
    1. Change the Layout Name to “Committee List”.
    2. Set Show records from: to COMMITTEE.
  1. Do the same for the other layout. Double-click Member Detail Copy. In Layout Setup:
    1. Change the Layout Name to “Committee Detail”.
    2. Set Show records from: to COMMITTEE.
  1. Close the Manage Layouts window.

Step 3 - View committee list

Format the committee list layout.

  1. Enter Layout mode using the Edit Layout button in the status toolbar.

    Note: You can also enter Layout mode using the View > Layout Mode menu item, or the keyboard shortcut Command-L (macOS) / Control-L (Windows).
  2. Use the Layout pulldown menu in the status toolbar to navigate to the Desktop > Committee > Committee List layout.
  3. In the Header part, double-click the title and change it from “Members” to “Committees”.
  4. In the Body part, double-click the Member_Name field. In the Specify Field dialog, select Current Table (“COMMITTEE”) from the drop-down and select the Name field.
  1. Remove all other fields from the Body part: select the fields and field labels and press Backspace or Delete.

    Note: be careful not to delete the transparent button in the background of the Body part. You will need it later to navigate from list to detail view.
  2. Add the Status field:
    1. Select the Name field and its label and duplicate them (Edit > Duplicate).
    2. Place them to the right of the Name field.
    3. Change the field label to “Status”.
    4. Double-click the Name field and change it to Status.
  3. In the Footer part, remove the “Export As...” and “Print” buttons. Leave the “New Member” button like it is for now.
  1. Use the Exit Layout button to return to Browse mode and review your progress. Keep in mind there are no records in the Committee table yet.

    Note: You can also enter Browse mode using the View > Browse Mode menu item, or the keyboard shortcut Command-B (macOS) / Control-B (Windows).

Step 4 - New committee script and button

You will build a script to create a new committee record and attach the script to the button on the 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 folder by clicking the Create a new folder icon at the top of the Scripts pane, and name it “Committee".
  1. Create a new script by duplicating the Template Script in the Example Scripts folder (select the script and select Scripts > Duplicate Script) .
    1. Name the script “Add Committee” (select duplicated script and select Scripts > Rename Script).
    2. Move it into the Committee folder.
    3. Right-click the Committee folder, and select the option to Exclude from Scripts Menu.
  2. Modify the script by adding the highlighted steps below.

    Note: Any time you copy the template script, be sure to move the script to an appropriate folder, and amend the comments at the top to fit your current script.

Allow User Abort [ Off ]
Set Error Capture [ Off ]
Freeze Window

# Do not proceed if current record can not be committed
Perform Script [ Specified: From list ; “Try To Commit or Halt” ; Parameter: ]

# Navigate to detail layout
Go to Layout [ “Committee Detail” (COMMITTEE) ; Animation: None ]

# Create new record
New Record/Request
Go to Field [Select/perform ; COMMITTEE::Name ]

Exit Script [ Text Result ; $null ]

  1. Close Script Workspace and save the script when prompted.
  2. Next, attach the new script to the button in the Committee List layout:
    1. Enter Layout mode.
    2. On the Committee List layout, double-click the “New Member” button.
    3. In the Button Setup dialog, rename the button to “New Committee” and select the Add Committee script.
  1. Exit Layout mode and save your changes.

Step 5 - Show Committee Detail script and button

You will write a script that navigates to the Committee Detail layout when a user clicks on a committee in the list.

  1. Open the Script Workspace.
  2. Create a new script by duplicating the script Member - Go To Related Record ( context ).
    1. Name the new script “Committee - Go To Related Record ( context )”.
    2. Move it into the Committee folder.
  3. Modify the script by removing script steps and adding the highlighted script steps so that your script looks like the following:

Allow User Abort [ Off ]
Set Error Capture [ Off ]
Freeze Window

# Parse the parameters
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 [ Result: False ]
End If

If [ $context = "Committee_List to Committee_Detail" ]
          # Committee List to Committee Detail
         Go to Layout [ “Committee Detail” (COMMITTEE) ; Animation: None ]
End If

Exit Script [ Result: $null ]

  1. Save the script and close the Script Workspace.  
  2. Enter Layout mode. 
  3. On the Committee List layout, double-click the transparent button in background of the Body part.
  1. In the Button Setup dialog:
    1. Select the Committee - Go To Related Record ( context ) script.
    2. Change the script parameter to: # ( "context" ; "Committee_List to Committee_Detail" )
  1. Enter Browse mode to save and review your work.

Step 6 - View committee details

You will adapt the copy of the member detail layout to display committee detail information.

  1. Enter Layout mode and navigate to the Committee Detail layout.
  2. In the Header part, double-click the title and change it from “Members” to “Committees”.
  3. In the Body part, double click the label “Member Detail” and change it to “Committee Detail”. The style applied to this label converts lowercase characters to all caps.
  4. Double click the merge field field "<<Member_Name>>" and change it to "<<Name>>".

    Note: Merge fields are text objects that show field data. Users cannot click into them or modify them as they can with regular field objects.
  5. Remove the merge field "<<Organization>>".
  6. Select and remove the tab controlwith Details, Donations, and so on. This will delete the tab control and all of its contents, including the portal and button.
  7. Select and remove the gray horizontal line.
  8. Activate the Fields tab of the Objects pane. (View > Objects > Fields Tab)
  9. Ensure Current Table (“COMMITTEE”) is selected from the drop-down in the left panel and select the fields Name and Status
  10. At the bottom of the tab, set the Labels to Place labels above fields...:
  1. Set the Field Placement to Place fields horizontally...:
  1. Drag both fields to the Body of the layout. The result should look like this:
  1. Double click the MEMBER portal on the left.
  2. In the Portal Setup dialog, set Show records from: to Current Table (“COMMITTEE”).
  1. In the portal, double-click the fields Member_Name and Status and change them to COMMITTEE::Name and COMMITTEE:: Status.
  1. Return to Browse mode to save and review your work.

Step 7 - Adapt existing layouts for navigation

You will add a new icon to the dashboard landing page, add a new entry to the navigation card window, create a new script to display a list of committees, and update the navigation script.

  1. Enter Layout mode and navigate to the Desktop > Dashboard layout.
  2. Select the “Members” button and duplicate it. You can Copy and Paste this buttonor you can use the keyboard shortcut Command-D (macOS) / Control-D (Windows).
  3. Double-click the newly created button to open the Button Setup dialog.
    1. Set the label to “Committees”.
    2. Choose an icon such as the one shown below.
    3. Change the Optional Script parameter: to # ( "nav" ; "Committee" )
  1. Arrange the icons so that the Dashboard now looks like this:
  1. Use the Layout pulldown menu in the status toolbar to switch to the Desktop > Menu | Card layout.
  2. Double-click on the last segment of the button bar. The Button Bar Setup window will open.
    1. Click the + button to add a Segment to the button bar.
    2. Set its label to “Committees”.
    3. Set Action to: “Perform Script”.
    4. Select the Nav Menu script from the list. (You can find it in the Generic Scripts folder.)
    5. Set the optional Script Parameter to: #( "nav" ; "Committee" )
  1. Select the Button Bar object and in the Position tab of the Inspector adjust the 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.) Your layout should now look like this:
  1. Open the Script Workspace (Scripts > Script Workspace...).
  2. Create a new script by duplicating the Template Script.
    1. Name the script “Committee Go to List”.
    2. Move it into the Committee folder.
  3. Modify the script by adding the highlighted steps below.

    NOTE: See Step 11 for details on the Sort Records step

Allow User Abort [ Off ]
Set Error Capture [ Off ]
Freeze Window

# Navigate to layout
Go to Layout [ “Committee List” (COMMITTEE); Animation: None ]

#Sort by Timestamp Created, descending
Sort Records [ Restore; With dialog: Off ]
Go to Record/Request/Page [ First ]

Exit Script [ Result: $null ]

  1. For the Sort Records step, click the gear icon to the right of the step and select Specify sort order to open the Sort Records dialog. Select the COMMITTEE table occurrence from the drop down list and select the zz_Log_Create_Record_TS field. Click Move to add the field to the Sort Order and then choose Descending order.
  1. From the Scripts menu select Save Script.
  2. Open the Nav Menu script.
  3. Add the highlighted code in the script. You find it near the end of the script.

If [ $nav = "Campaign" ]
   # Campaign List
   Go to Layout [ “Campaign List” (CAMPAIGN) ; Animation: None ]
   Show All Records
   Perform Script [ Specified: From list ; “Campaign - Go to List” ; Parameter: ]
          #
Else If [ $nav = "Member" ]
   # Member List
   Go to Layout [ “Member List” (MEMBER) ; Animation: None ]
   Show All Records
   Perform Script [ Specified: From list ; “Member - Go to List” ; Parameter: ]
   #
Else If [ $nav = "Donation History" ]
   # Member List
   Go to Layout [ “Donation List” (DONATION) ; Animation: None ]
   Show All Records
   Perform Script [ Specified: From list ; “Donation Go to List” ; Parameter: ]
   #
Else If [ $nav = "Committee" ]
  # Committee List
  Go to Layout [ “Committee List” (COMMITTEE) ; Animation: None ]
  Show All Records
  Perform Script [ Specified: From list ; “Committee Go to List” ; Parameter: ]
End If

Exit Script [ Text Result: $null ]

 

  1. Close the Script Workspace and save the script when prompted.

Step 8 - Review your work

With the basics of the schema, interface, and scripting now in place, you can test the new committees features.

  1. From the Dashboard or the navigation menu on any layout, you should have the option of navigating to Committees. You should see a complete list of committees with the most recent on top. (Until you create new records, this list will be blank.)
  2. When you click the New Committee button, you should see the Committee Detail layout and be shown a blank new record.
  3. Committees you create should display in the portal on the left side of the Committee Detail layout.