Creating a Database in FileMaker Pro 8: Visual QuickProject Guide
Go to Tab will be the first multi-step script we'll create. This script is responsible for displaying the appropriate tab for the current investment record in Main and will be attached to the Tab button above the Main layout. The reason we're creating it first is because this script is also called (executed) by several other scripts. Like other multi-step scripts, it must be created in ScriptMaker, FileMaker's script-editing tool. Here's the script as it will look in the Edit Script dialog box: This script uses an If and a series of Else If steps to determine what data the current record has stored in the Account Type field. As soon as an If or Else If test has been satisfied, the step immediately following the test is executed. Then the script skips any additional tests and jumps directly to the End If step. Thus, when a match to one of these text strings is found (Savings/Money Mkt, Stock/Mutual Fund, CD, Savings Bond), a Go to Field step is executed that displays the specified field. Since each field is present on only one tab panel (for example, CD_Institution occurs only on the CD tab panel), this step forces the correct panel to be displayed. The Else step near the end of the script is a catch-all that handles records for which no Account Type has been specified or in which you've manually entered a different text string. The Show Custom Dialog step presents a dialog box to the user, explaining that a selection must be made for the Account Type field. Until this is accomplished, the correct tab cannot be displayed. Double-click the Account Type field in Main's field list to insert it into the formula. Then type the rest of the formula. Be sure that the text in quotes is copied exactly. Click OK to close the dialog box. The If step in the script is now modified to include this test within its parentheses. With the If step selected in the script, add Go to Field as the second step. (New steps are inserted immediately after the currently selected step.) Click the Specify button. In the Specify Field dialog box, select Sav_Institution from the Main table, and then click OK. Click the Specify button. In the Specify Calculation dialog box, create this formula: Main::Account Type="Stock/Mutual Fund" Else If [Main::Account Type="CD"] Go to Field [Main::CD_Institution] Else If [Main::Account Type="Savings Bond"] Go to Field [Main::Bond_Serial#] Note: When entering text in this dialog box, it isn't necessary to type the quotation marks. FileMaker adds them for you. |
Категории