filemaker pro 11 the missing manual phần 3 pot

91 358 0
filemaker pro 11 the missing manual phần 3 pot

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

158 FM P : T M M Using Tab Controls Editing Tab Controls As you just saw, you can add a Tab Control any time you need to fit more stuff on a layout. And once it’s there, you can add or delete panels or change the control’s ap- pearance. Edit a Tab Control by double-clicking it in Layout Mode to summon the Tab Control Setup dialog box. Adding, removing, and reordering tabs In the Tab Control Setup dialog box, you can add new tabs by typing a name, and then clicking Create. The new tab appears at the end of the list of tabs, and to the right of the existing tabs in the control. You can also rename an existing tab: Select it in the list, enter a new name, and then click Rename. To delete a tab, select it in the list, and then click Delete. When you delete a tab, you delete all the objects on that tab. (If the tab you select for deletion has any objects on it, FileMaker warns you first, and asks whether you’re sure you know what you’re doing.) Finally, you can control the tab panels’ order. FileMaker draws the tabs in the order they appear in the Tabs list. The leftmost tab panel is the one that appears to the top of the list, and so on. Rearrange the list using the arrows to the left of each name. FileMaker’s smart enough to move the objects on each tab along with the tabs them- selves when you reorder. Default Front Tab When you first switch to a layout but before you’ve clicked a tab, FileMaker needs to decide which tab to show automatically. You tell it which one by choosing the appropriate tab name from the Default Front Tab pop-up menu. While it’s possible to choose any of the tab panels, be aware that most places where tabs appear, the leftmost tab is usually the front tab. If there’s a compelling reason for a tab to always be in front when you first see a layout, it’s pretty likely that that tab should be on the left, too. Tab justification If the total width of all your tabs is less than the width of the Tab Control itself and you haven’t chosen Full justification, then FileMaker lets you choose where the grouping of tabs should be positioned. It’s a lot like aligning a paragraph of text: choose from Left, Center, or Right and the tabs will bunch up according to your selection. Note: If you have more tabs than can fit given the size of the Tab Control, then FileMaker simply doesn’t show the extras. You can either force the tabs to be narrower using the Tab Width option (see below), make the Tab Control itself bigger, or make the tab names shorter. 159  :      Using Tab Controls Appearance FileMaker can draw tabs with Rounded or Square corners. This option is purely cosmetic, so choose whichever one you like from the Appearance pop-up menu. Note: If you’re publishing your database on the web using Instant Web Publishing (page 735), rounded rectangles (tab panel tabs and buttons included) render with square corners. They work just fine though. Tab width The Tab Width pop-up menu has several choices to influence the width of the tabs: • The standard setting, Label Width, makes each tab just wide enough to hold its label. • “Label Width + Margin of” adds the amount of additional space you specify around the label text. The label’s text will be centered within the tab. • If you prefer all your tabs to be the same width, choose “Width of Widest Label”. FileMaker figures out which label is biggest, sizes that tab appropriately, and then makes the others match. This setting may push some tabs out of view if they won’t all fit with the new width. • If you’d like all your tabs to be a nice consistent width, but with the ability to accommodate the odd long label, choose “Minimum of”. Enter a minimum width (75 pixels, say), and every tab will be that width, unless the label is too big to fit, in which case that one tab will widen enough so the label fits. • If you want the utmost in control and uniformity, choose “Fixed Width of ”, and then enter a width in the box. Every tab is exactly that width. If the label’s text is too big, then FileMaker cuts it off at the edges. POWER USERS’ CLINIC Tab in a Tab If your layouts have more doodads than the bridge of the Enterprise, take heart. You can put a Tab Control on an- other tab for even more space savings. That’s right. You can put tabs inside tabs inside tabs. So long as the new control sits entirely inside an existing tab, it behaves just like any other object on a panel. It sits there quietly be- hind the scenes and doesn’t make an appearance until you click its enclosing panel. Only then is it visible, in all its tabbed glory. Needless to say, the more you use the tab-within-a-tab technique, the more complex your layout becomes—and the more potentially confusing to anyone using your database. Multiple nested tabs can also dramati- cally increase the amount of time it takes your computer to draw a layout when you’re sharing a file using FileMaker Server (page 741). Use this technique sparingly. 160 FM P : T M M Adding Merge Fields Note: Full tab justification overrides some settings in the Tab Width pop-up menu, so if you’re making changes and don’t see what you expect, make sure you haven’t selected Full in the Tab Justification pop- up menu. Formatting a Tab Control Out of the box, Tab Controls are medium gray, embossed, with a thick black border. But you can change that institutional look to match your carefully crafted layouts. In the toolbar’s Formatting Bar, just use the fill and border tools to make your selec- tions. You can even select each tab panel individually; the choices you make apply only to the currently selected tab. To select the whole Tab Control (all its tabs and all the objects on each tab), use the selection rectangle or Shift-click each tab panel. Tip: If you accidentally format a single tab panel when you meant to format the whole tab control select your newly formatted tab and use the Format Painter (page 125) to apply formats to each unformatted tab panel. Deleting a Tab Control If you don’t want a Tab Control after all, just select it, and then choose Edit➝Clear, or press Delete or Backspace. FileMaker warns you that it’s about to delete all un- locked objects on the tab panel as well. If that’s all right with you, click OK. If you need to keep fields or objects on the tab panels, though, click Cancel, and then move the keepers off the panel (way to the right of your layout, perhaps) for safekeeping. Adding Merge Fields Your First and Last Name fields are now down on the General tab (Figure 4-17), where you can’t see when you switch to the Payment or PDF tabs. It would be helpful to see which Lease Document you’re dealing with as you switch tabs. You could add copies of the name fields on each tab, but there’s a better way. You can create a text object that contains merge fields to display the data from each record’s First Name and Last Name field. A merge field is a text block containing the field’s name, sur- rounded by a pair of double angle brackets like this: <<First Name>> Besides being useful for displaying data on layouts, merge fields are often used for things like form letters, labels, or envelopes. Either way, merge fields expand and contract to use only the actual amount of space required by data inside the fields they represent. You can’t enter or edit data using a merge field, nor can they be searched in Find mode (but the Quick Find in Browse mode will search merge fields). But that’s no problem here—you’ll keep and use the normal First Name and 161  :      Adding Merge Fields Last Name fields for those purposes. In this case, a couple of merge fields help ori- ent you as you switch tabs, and are a more attractive way to display data than using normal fields would be. 1. In Layout mode, select the Text tool, and then change the formatting to 18-pt Helvetica Bold. By choosing formatting before you click to create a text block, you’re not only presetting the text block’s format, you’re changing your file’s default text format. 2. Click in the blank space above the tab control. A blinking insertion point appears. 3. Choose Insert➝Merge Field., Or use the shortcut Ctrl+M (Windows) or Option-�-M (Mac). The Specify Field dialog box appears (Figure 4-19). 4. Double-click the First Name field, and then press the space bar. The First Name merge field, “<<First Name>> ”, appears inside your text block. You add the space so that the Last Name doesn’t run onto the First Name. Tip: If you know the exact name of the field(s) you want, you can type it instead of using the Insert➝Merge Field command. Just be careful to get the angle brackets and name of the field exactly right. If you make a mistake, all you’ll see in Browse mode is what you typed, and not the data you expect. 5. Make sure that the insertion point is still blinking after the First Name and space in the text block, and then Choose Insert➝Merge Field again. Double- click the Last Name field. The text “<<First Name>> <<Last Name>>” now appears inside the next block. Adjust the placement of the text block if necessary. Switch to Browse mode to see that the field’s contents appear inside the merge fields there. You can format merge fields just like any other text block. But since they also con- tain data, if you apply formatting from the Inspector’s data tab to text blocks that contain merge fields, FileMaker displays the data according to your formatting. So if you put a merge version of the Rental Fee field on the Payment tab (so you can see what the Rental Fee’s supposed to be as you record each payment), don’t forget to format the text block as currency. You can use merge fields to create a form letter (you’ll get one copy for each record in the found set, with appropriate data for each record). Just type the text of the letter inside a large text block, and then insert merge fields within the text as appropriate. You’ll also see heavy use of merge fields if you use the Layout/Report Assistant to create label or envelope layouts. 162 FM P : T M M Adding Merge Fields Using Symbols to Show Important Info Merge fields aren’t the only things FileMaker can use to show dynamic information. You use one of a handful of special symbols—stand-in characters that are replaced with info when you view your database in Browse or Preview mode. For example, see Figure 4-19, where each record on the Lease Agreement List layout is numbered. The record number symbol displays an automatic number for each record. Note: FileMaker offers a host of other symbols besides the record number symbol. See the box on the next page for details. Figure 4-19: The number to the left of each record on the Lease Agreement List layout comes from a special symbol placed on the layout. Sort the list, and notice that the records change order, but the record numbers themselves stay in sequence. The record number is meant to help you figure out where you are in a list, but not to identify any specific record. See page 137 for a way to assign a permanent ID number, or key, to a record. To add a record number to your Lease Agreement List layout, choose Insert➝Record Number Symbol. You now have a text object that contains “@@”. You may need to format the record number merge field. Switch to Browse mode, where you see that FileMaker puts the current record number in place of the symbol. You can also insert symbols into existing text objects. Just click into the text object first, as if to type. Then when you choose Insert➝Record Number Symbol, File- Maker adds the record number symbol to the existing text. 163  :      Writing a Basic Script UP TO SPEED Other Symbols On the Insert menu, FileMaker includes symbols for sev- eral special values you may want to show on a layout. In Browse mode (or Preview mode), FileMaker replaces the symbol with the up-to-the-moment correct value. You can read about the record number symbol on the previous page. Here are the other symbols: • The date symbol (//) is replaced by the current date. You’d include this symbol on printed reports so you can easily see when the reports were printed • The time symbol (::) is replaced by the current time. If your reports needed to be identified down to the hour and minute they were printed, add this symbol to a report’s header or footer. • The user name symbol (||) is replaced by the current user’s name. FileMaker takes the user name of who- ever’s logged into your computer (or the custom User Name if one is entered in FileMaker’s Preferences). To clarify: That’s two pipe symbols—Shift-backslash on most keyboards—typed side by side. • The page number symbol (##) is replaced by the page number in Preview mode and when you print. Otherwise, it just shows as a question mark. The Insert menu has three related options as well, but unlike symbols, these don’t get replaced by anything in Browse or Preview mode. When you use the Insert➝Current Date command, for instance, FileMaker simply adds today’s date to the text object in Layout mode. It’s a static value (that is, it never changes) and shows the same date in any mode. You can use the Insert menu to place symbols where you need them, but just like Merge fields, you can type them in manually faster and easier. So once you’ve seen that “##” makes a page number, forget about mousing around, and just type the two number signs. Writing a Basic Script Now that you have a record number on the Lease Agreement List layout, and have sorted the list, you can start to see how useful the layout really is. The Lease Agree- ment layout is great for revealing detail, but when the Lease Agreement List layout is sorted by Last Name, it’s a cinch to scroll to the record you need without entering Find mode, typing in search criteria, and then performing a find. But it could be easier sort the records on the layout. As it is, you’ve got to choose Records➝Sort Records, select the field you want to sort by, and then click Sort. All this stuff is easy, but efficiency is king in your world. The solution is to write a script to do these things automatically. If you’re familiar with macros in other programs, then you already get the idea of scripts in FileMaker—you set up scripts to perform tasks for you. The task at hand— sorting—is just one command, but it has several steps. They’re all quick steps, but when you have to repeat them several times a day and so does everyone else in your office, all that wasted time adds up to real inefficiency. Also, any manual process leaves room for human error. When you make a mistake, no matter how harmless, you have to undo or redo what you just did. A script that handles your sort is more efficient and less susceptible to error. 164 FM P : T M M Writing a Basic Script Creating a Sort Script Here’s how to write a script that sorts the records on your list layout alphabetically by Last Name and then First Name: 1. Choose Records➝Sort Records. Set up the window to sort by Last Name and then First Name (page 38), and then click Sort. Every time you open the Sort window, the last sort order is already in the win- dow. It works the same way for scripts. So save yourself some time by perform- ing the sort first. That way, when you write the script, the order will already be in the Sort window. 2. Choose Scripts➝Manage Scripts. The Manage Scripts dialog box appears. 3. Click New. The Edit Script dialog box appears (Figure 4-20). Figure 4-20: The Edit Script window contains everything you need to write a script, whether it’s a simple one-line script or a hundred-line monster. Here the list of available script steps is filtered by View: Found Sets, but you can also sort all the script steps alphabetically if you prefer. Many of the script steps available are the same as the commands in FileMaker’s menus. If you know how to use those commands manually, you know how they’ll behave as script steps. But there are some commands that you can only access through scripting, and the subject is so deep and wide that this book has three chapters, 10, 11, and 16, devoted to the subject. 165  :      Writing a Basic Script 4. In the Script Name field, type Sort by Last Name. As always, give everything you name in FileMaker a descriptive name. Mature databases can have hundreds of scripts, so good naming is the first step in keep- ing things organized. 5. In the View pop-up menu, choose Found Sets. The filters the list of script steps so you can easily pick the one you need. 6. Double-click the Sort Records script step. The Sort Records script step appears in the window’s Script pane. 7. Turn on “Perform without dialog”. Without this option selected, you’d see the regular Sort window every time you run the script. Don’t turn on this option when you’re writing a script that lets the user choose a custom sort as the script runs. 8. Turn on “Specify sort order”. The regular Sort window appears, with Last Name and then First Name set up already. As you know, FileMaker remembers your most recent sort order, but it’s good practice to verify everything when you’re scripting. And if you wanted a different sort order, you can change it and the script will remember your changes. 9. Click OK to close the Sort window, and then, in the Edit Script window, click Close. FileMaker asks if you want to save the script’s changes. 10. Click Save. FileMaker saves the script and closes the Edit Script window. 11. Make sure “Include in Menu” is turned on for the Sort by Last Name script, and then close the Manage Scripts window. Now that the Manage Scripts window is closed, you need some way to run the script you just wrote. Look in the Scripts menu. It appears there, along with a shortcut. You can run the script by choosing Scripts➝Sort by Last Name or by using the shortcut. Tip: Windows users can save scripts before closing the Edit Script window by choosing the Edit Script win- dow’s File➝Save Script command. Both PC and Mac fans can use the Save Script shortcut Ctrl+S (�-S). Now that the script is ready to go, Unsort your records (choose Records➝Unsort), and then run the script. 166 FM P : T M M Writing a Basic Script Creating a Button Running the script from the menu saved you a few steps, but you can make it even more convenient by attaching the script to a layout object, which then becomes a button. Then whenever you click the button in Browse mode, the script runs auto- matically. Here’s how: 1. In Layout mode, click the Last Name Field’s label to select it. It’s a common convention to click a column label to sort a column, so help your users out by adopting that principle. 2. Choose Format➝Button Setup. The Button Setup window appears (Figure 4-21). Figure 4-21: The Button Setup window lets you choose from most of the same steps you see in the Edit Script window. The difference is that you can only choose a single script step when you define a button this way. Any time you need a process that requires two or more script steps, create a script and then attach it to the button. But even if the process is a single step, you may still want a script, so you can format it to appear in the Script menu. Even better, if you apply a script to several buttons throughout your database, you can change the script and all the buttons will run the edited script automatically. But if you had attached script actions to those buttons instead of a script, you’d have to change each one manually. 3. In the script step list, click Perform Script. This “controller” script step lets you run any script you’ve written by attaching it to a button. 167  :      Writing a Basic Script 4. In the Options section of the window, click Specify. The Specify Script window appears, showing a list off all the scripts in your da- tabase. You’ve only got one, but it’s not uncommon to have hundreds. 5. Click the “Sort by Last Name” script, and then click OK until you’re back on your layout. Your button is ready to use. Switch to Browse mode, and then Unsort your records, if they’re sorted. Finally, click the Last Name field label to see the script run. You haven’t put anything on your layout to indicate to your users that the field label does anything useful. FileMaker changes the pointer to a hand icon when it’s positioned over any button, but you have to give users a reason to wander up there with their mouses. So change the la- bel’s formatting (make it a contrasting color, or put a border around it so that it looks like a button) to help users out. (Learn more about buttons on page 317.) Tip: Check out this chapter’s Lease Agreement Finished.fp7 file to look under the hood at some format- ting options and a beefed up script that can sort by different fields, depending on a script parameter (explained on page 686). Applying a Script Trigger The script was nice, and the button improved things, but you’re still not done learn- ing how useful and intuitive scripts can be. Since the point of going to the list layout is to quickly scan a list so you can find a particular Lease Agreement record, it’d been even more convenient if the list just knew to sort itself every time you switch to the layout. And that kind of thing is what Script Triggers are for. You’ve just seen that you can run a script from the Scripts menu or from a button. But you can also tell a script to run when you do other things, like enter data in a field or go so a specific layout. Here’s how to make the Sort by Last Name script run every time you go to the Lease Agreement List layout: 1. If you’re not viewing the Lease Agreement List layout, switch to it. Then in Layout mode, choose Layouts➝Layout Setup. You’ll learn about this dialog box’s other options in Chapter 7. For now, you’re interested in the Script Triggers tab. 2. Click the Script Triggers tab. The Script Triggers tab appears (Figure 4-22). [...]... get the information you need from the ad hoc report without fuss As with the dynamic report in the previous section, you have to sort the records by the Trailing Group you chose for the summaries to show up But unlike the dynamic report, FileMaker doesn’t sort the data automatically if you leave this layout and then come back to it later Click the Rental Fee column head to sort the records and the. .. that the layout doesn’t have a new part added to it Nor does the Count field actually appear on the layout That’s why this type of report is temporary It’s meant to let you get a quick, bird’s-eye view of your data and then get right back into your other tasks (or to the meeting on time and with the data you were told to have at your fingertips) 174 FileMaker Pro 11: The Missing Manual Changing the. .. After you click Next, the Specify Grand Totals window appears 170 FileMaker Pro 11: The Missing Manual Creating a Dynamic Report with the Assistant Figure 4-24:  You’d see this same window if you used the Manage Database window to create a summary field Summary fields do just what their name implies: they summarize groups of data You can apply one of several mathematical operations to the fields, including... you do by company, then you probably want a Companies table FileMaker Pro 11: The Missing Manual Modeling Your Database Finding Relationships Now that you have a list of entities, you need to figure out how they relate to one another To get started, just pick two of your entities—Customers and Jobs, for example—and ask yourself how they go together (if you need some guidance, see the box on page 192)... check the operation you’re trying to perform It may not be the right option for the field you want to summarize (or the field’s definition may be set to the wrong type) 9 Click Specify The Specify Field window appears The Count field you just created appears in the list 10 Click the Count field to select it, and then click OK Leave the Grand total placement pop-up menu set to “End of report”, and then... at the end of the report and will give you a grand total count of all the records you’re viewing After you click Next, the Select a Theme window appears 11 If it isn’t already selected, select Default from the Layout Themes list, and then click Next The Header and Footer Information window appears chapter 4: adding power to your database 171 Creating a Dynamic Report with the Assistant 12 From the. .. choose Layout Name From the Footer’s Bottom left pop-up menu, choose Current Date Then click Next The Create a Script for this Report window appears 13 Click the “Create a script” option, and then type Lease Agreement Report in the “Script name” box Select the “Run script automatically” option, and then click Next FileMaker writes a script for you that sorts your records properly (the data in subsummary... sorted into the proper group, and the Count field is updated immediately The same thing’s true if you edit data in the field on which the sort is based (remember that this report is always sorted by the Lease Duration field) Change some data in a Lease Duration field, and then commit the record It will sort into the proper group If you add data that’s not in an existing group (say you type 48 in the Lease... and down in the list on the right After you click Next, the “Organize Records by Category” panel appears 4 Move the Lease Duration field into the Report categories list, and then click Next The sample report changes as you move fields into the Report categories list After you click Next, the Sort Records panel appears 5 Move the Last Name and First Name fields into the Sort order list, and then click... list, and then click OK until you’re back on the Specify Subtotals panel Now click Add Subtotal When your window looks like Figure 4- 23, click Next FileMaker creates a new Count field (Summary type) and at the end of this process, you’ll see a Subsummary part (you’ll learn how to create them manually on page 6 03) based on the options you just chose The summary field counts each record in the sorted . control the tab panels’ order. FileMaker draws the tabs in the order they appear in the Tabs list. The leftmost tab panel is the one that appears to the top of the list, and so on. Rearrange the. can fit given the size of the Tab Control, then FileMaker simply doesn’t show the extras. You can either force the tabs to be narrower using the Tab Width option (see below), make the Tab Control. symbol with the up-to -the- moment correct value. You can read about the record number symbol on the previous page. Here are the other symbols: • The date symbol (//) is replaced by the current

Ngày đăng: 14/08/2014, 08:21

Từ khóa liên quan

Mục lục

  • Part Three: Thinking Like a Developer

    • Chapter 5. Creating and Managing a Relational Database

    • Chapter 6. Field Options

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan