create more scripts


Now that you've created your first script, you should be ready to make the others. For each one, I'll describe what the script does and point out any critical steps you might not readily understand. I'll explain later how to attach some of these scripts to buttons and how to list others in the Scripts menu.

Prev Record, Next Record. This pair of scripts will be attached to the navigation buttons at the bottom of the Main layout. When clicked, you'll switch to the previous or next record in the current sort order. By calling the Go to Tab script as the final step, the matching tab panel for the record will automatically be displayed. The scripts are identical other than the first step's option.

Prev Record Step

Step Options

Go to Record/Request/Page

Previous

Perform Script

Go to Tab


Next Record Step

Step Options

Go to Record/Request/Page

Next

Perform Script

Go to Tab


Resize Layout. When necessary, this one-step script will quickly adjust the size of the current layout. Later, we'll assign a / combination to it.

Resize Layout Step

Step Options

Adjust Window

Resize to Fit


Sort Main. This script will be attached to the Sort button at the top of the Main layout, enabling you to restore the sort order for the table after adding records, performing a Find, or another procedure that destroys the sort order. A Show All Records step is included to ensure you're working with all the table data, rather than a subset. (When adding Account Type as the first sort field, click Custom order based on value list and select Account Type as the value list.)

Sort Main Step

Step Options

Show All Records

 

Sort Records

Account Type (based on Account Type value list), Description; No dialog

Perform Script

Go to Tab


Display Record List. This script will be attached to the List button above the Main layout. When clicked, FileMaker will display the Account List layout, ensure that all records are visible, sort them appropriately, and then adjust the window size to display the record list.

Display Record List

Step Options

Go to Layout

Account List

Show All Records

 

Sort Records

Account Type (based on Account Type value list), Description; No dialog

Adjust Window

Resize to Fit


View Record. This script will be attached to each View button on the Account List layout. When you click a record's View button, the selected record is shown in the Main layout.

View Record Step

Step Options

Go to Layout

Main

Perform Script

Go to Tab

Adjust Window

Resize to Fit


Opening Script. Optionally, you can create a script that runs automatically when a database is opened or closed. The Opening Script ensures that the database is ready to use. It switches to the Main layout, resizes the window, ensures that all records are visible and sorted correctly, and then displays the first record. Later in the chapter, you'll set it as the opening script.

Opening Script Step

Step Options

Go to Layout

Main

Adjust Window

Resize to Fit

Show All Records

 

Sort Records

Account Type (custom order based on Account Type value list), Description; No dialog

Go to Record/Request/Page

First

Perform Script

Go to Tab


Add Savings Record, Record Stock Dividend, Record CD Interest. Each of these scripts will be attached to a transaction button on the Savings/Money Market, Stock/Mutual Fund, or CD tab panel of the Main layout. When the button is clicked, it will create a new record in the transaction table in which you can record the data. To ensure that the savings account number, stock description, or CD certificate in the transaction table matches the one in Main, a set of Copy and Paste script steps are employed. The Copy step copies the account number, description, or certificate ID from the record in Main; Paste puts the copied data into the matching field in the transaction table.

In preparation for data entry, the cursor is positioned in the Date field. While you're entering the data for the transaction, the script pauses until you click the Continue button. Then you're returned to the Main layout.

Then select the duplicate, click Edit, rename the duplicate, and make the necessary changes to the steps. Repeat this process to create the third transaction script.

Note: The final four steps (Pause/Resume Script, Go to Layout, Adjust Window, and Perform Script) are identical in all three scripts. To save space, these steps are only listed at the end of the Add Savings Record script. Be certain they are present in the other two scripts.

Add Savings Record Step

Step Options

Copy

Main::Sav_Savings Account; Select entire contents

Go to Layout

Savings

New Record/Request

 

Paste

Savings::Account; Select entire contents; Paste without style

Go to Field

Savings::Transaction Date; Select/perform

Pause/Resume Script

Indefinitely

Go to Layout

Main

Adjust Window

Resize to Fit

Perform Script

Go to Tab


Record Stock Dividend Step

Step Options

Copy

Main::Description; Select entire contents

Go to Layout

Stocks

New Record/Request

 

Paste

Stocks::Identifier; Select entire contents; Paste without style

Go to Field

Stocks::Dividend Date; Select/perform


Record CD Interest Step

Step Options

Copy

Main::CD_Certificate; Select entire contents

Go to Layout

CD

New Record/Request

 

Paste

CD::Identifier; Select entire contents; Paste without style

Go to Field

CD::Date; Select/perform


Note: When editing the duplicate scripts, be very careful to specify fields from the correct table. Both Stocks and CD table have an Identifier field, for example.

Savings Report, CD Report, Savings Bond Report. These report scripts are identical; only the options for Steps 24 differ. Create the first script, duplicate it, and edit the options to create the other two scripts. The script starts by finding the records needed for the report, based on the data in Account Type. Then it switches to the report layout, sorts the data, sets the window as large as the screen (Mac) or FileMaker window (PC) allows, and enters Preview mode.

The script then pauses so you can examine the report. If the report has multiple pages, you can view them by clicking pages of the Book icon. If you want to print the report, you can choose the Print Current Report script from the Scripts menu. When you're done viewing the report, click the Continue button in the status area. The script ends by switching back to Browse mode on the Main layout, adjusting the window size, showing all records again, and sorting them.

Savings Report Step

Step Options

Go to Layout

Main

Perform Find

Main::Account Type = "Savings/Money Mkt"

Go to Layout

Savings Report

Sort Records

Main::Sav_Institution, Main::Sav_Savings Account; No dialog

Adjust Window

Maximize

Enter Preview Mode

Pause

Enter Browse Mode

 

Go to Layout

Main

Adjust Window

Resize to Fit

Show All Records

 

Sort Records

Account Type (based on Account Type value list), Description; No dialog

Perform Script

Go to Tab


To create the Find criteria for the second step, add the Perform Find step and click the Specify button. In the Specify Find Requests dialog box, click New.

In the Edit Find Request dialog box, select Account Type from the Find records when list, and type Savings/Money Mkt in the Criteria box.

Click Add to add this as a new criterion. Click OK to close the dialog box, and click OK again to close the Specify Find Requests dialog box.

CD Report Step

Step Options

Go to Layout

Main

Perform Find

Main::Account Type = "CD"

Go to Layout

CD Report

Sort Records

Main::CD_Institution, Main::CD_Certificate; No dialog

Adjust Window

Maximize

Enter Preview Mode

Pause

Enter Browse Mode

 

Go to Layout

Main

Adjust Window

Resize to Fit

Show All Records

 

Sort Records

Account Type (based on Account Type value list), Description; No dialog

Perform Script

Go to Tab


Savings Bond Report

Step Options

Go to Layout

Main

Perform Find

Main::Account Type = "Savings Bond"

Go to Layout

Savings Bond Report

Sort Records

Main::Bond_Serial #; No dialog

Adjust Window

Maximize

Enter Preview Mode

Pause

Enter Browse Mode

 

Go to Layout

Main

Adjust Window

Resize to Fit

Show All Records

 

Sort Records

Account Type (based on Account Type value list), Description; No dialog

Perform Script

Go to Tab


Stock Report. This report script differs a little from the previous three. Because it must be displayed in landscape mode, it's necessary to add a pair of Print Setup steps. The first sets landscape mode so you can view the full width of the report. The second resets the mode to portrait, ensuring that regardless of what you do next (such as enter new investments, record a transaction, or generate a different report), the screen will have the correct orientation.

Stock Report Step

Step Options

Go to Layout

Main

Perform Find

Main::Account Type = "Stock/Mutual Fund"

Go to Layout

Stock Report

Sort Records

Main::Stk_Brokerage Firm, Description; No dialog

Print Setup

Orientation: Landscape; Paper Size: 8.5" x 11"; No dialog

Adjust Window

Maximize

Enter Preview Mode

Pause

Enter Browse Mode

 

Go to Layout

Main

Print Setup

Orientation: Portrait; Paper Size: 8.5" x 11"; No dialog

Adjust Window

Resize to Fit

Show All Records

 

Sort Records

Account Type (based on Account Type value list), Description; No dialog

Perform Script

Go to Tab


Print Current Report. When viewing a report onscreen, you can send it to the printer by running this one-step script. The method of setting options for the Print step depends on whether you're using a Mac or a PC.

When setting options on a Mac, select Copies & Pages from the drop-down list and click the All radio button in the Pages section. Select FileMaker Pro or FileMaker Pro Advanced from the drop-down list, and click the Records being browsed radio button. Click Print to complete the process.

When setting options on a PC, select Records being browsed from the Print drop-down list, and click the All radio button in the Print Range section.

Print Current Report Step

Step Options

Print

Records being browsed; All Pages; No dialog


Account Summary Report. Because it uses all records in Main (rather than relying on a Find to select a record subset) and uses the same sort specifications as Main, this script is simpler than the others and requires fewer steps.

Rather than create the script from scratch, it will be quicker to duplicate one of the initial three report scripts and make the necessary changes. Be sure to remove the unnecessary steps.

Account Summary Report

Step Options

Go to Layout

Main

Show All Records

 

Go to Layout

Account Summary Report

Sort Records

Account Type (based on Account Type value list), Description; No dialog

Adjust Window

Maximize

Enter Preview Mode

Pause

Enter Browse Mode

 

Go to Layout

Main

Adjust Window

Resize to Fit

Perform Script

Go to Tab





Creating a Database in FileMaker Pro 8. Visual QuickProject Guide
Creating a Database in FileMaker Pro 8: Visual QuickProject Guide
ISBN: 0321414837
EAN: 2147483647
Year: 2005
Pages: 115

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net