filemaker pro 11 the missing manual phần 4 pptx

91 331 0
filemaker pro 11 the missing manual phần 4 pptx

Đ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

249  :   Validation Options 6. In the text box below this checkbox, type The Zip Code you entered doesn’t look correct. Are you sure that’s what you really want? FileMaker displays this message if the validation fails. (For a little guidance on what these messages should say, see the box on page 252.) Figure 6-5: The “Options for Field” dialog box’s Validation tab lets you check for errors before placing information into fields. You can, for example, make sure only numbers are entered, or that the first name is no more than 30 characters. You can apply as many validation rules as you want, and FileMaker checks each one whenever someone modifies the field. 7. Click OK until you’re back on the Lease Agreement layout. Switch to Browse mode (if necessary); it’s time to test. Try entering too many characters into the Zip Code field, and you see your message when you exit the field, as shown in Figure 6-6. Note: It’s true that the validation settings you selected in the previous steps aren’t perfect. For example, they don’t allow Zip+4 codes (46077-1039). At the same time, they would let you enter something like 123, which isn’t a valid Zip code at all. To handle the nuances of the simple Zip code, you need to use the “Validate by calculation” option, which lets you set more specific validation standards by using the Specify Calculation dialog box. 250 FM P : T M M Validation Options Figure 6-6: If you enter a bogus Zip code in your database (background), you see your custom message. Click Yes to keep the invalid Zip code. If you want to fix it, click No and you’ll be back in the field. If you click Revert Field, the field value changes back to what it was before you started editing. Making Validation Stricter Your Zip Code field validation options work pretty well, but there’s a pretty glaring problem: anybody can enter just about anything they want, and then click Yes to tell FileMaker to accept the invalid data. It may help prevent mistakes, but it doesn’t ensure good information. To make FileMaker more insistent, revisit the Options for Field dialog box’s Valida- tion tab, and then turn off the “Allow user to override during data entry” checkbox (it’s near the top of the window). Since this change removes the user’s “Yes” and “No” choices when entering data, you also want to reword the custom message you entered. Change it to something more informative, like Zip Codes can contain no more than five characters, which have to be numeric. Please check your data entry and try again. 251  :   Validation Options With these settings in place, if someone enters a spurious Zip code, then he sees the error message shown in Figure 6-7. Figure 6-7: When you turn off the “Allow user to override during data entry” validation option, FileMaker won’t present a Yes to accept an invalid value. So any custom message you provide should not be phrased as a question. Instead, express the error as a statement or suggestion. FREQUENTLY ASKED QUESTION Numbers and Text You have to set an awful lot of validation options to make sure people enter only Zip codes into a text field. Can’t I just make the Zip Code field a number field instead? No, you can’t. Zip codes are numeric characters, but they’re not numbers, and that makes a big difference as far as FileMaker is concerned. For example, number fields don’t recognize leading zeros—like the ones at the beginning of 00501 and scores of other perfectly valid Zip codes. If you enter 00501 in a number field, FileMaker thinks you meant to type the number 501 and will treat it as the number 501 for almost all uses, including searches, sorts, and if saved to an Excel spreadsheet. But “almost all uses” may not get your mail to Holtsville, New York on time. FileMaker is kin- da, sorta forgiving on this point, but when you absolutely, positively have to rely on the Zip code entered in a field, text type (with a numeric validation) is the way to go. The Numeric Only validation option lets the field stay a text field (which preserves all entered characters) but still ac- cept only numerical digits on entry, which is exactly what you want for a Zip code. Some people also assume that a phone number should be stored as a number field. Wrong again. Phone numbers contain numerals and dashes, parentheses, and sometimes other special characters—all mere text to FileMaker. As a general rule, make a field a number field only if it’s express- ing a mathematical value like height in inches, or the price of a bag of potatoes. Note: The Validation tab has two more options related to this one. Under “Validate data in this field” you can choose “Always” or “Only during data entry”. Data entry has the same meaning here that it had for auto-enter options. If you switch to the more strict “Always” setting, FileMaker enforces your validation rules even when data is modified by a script (Chapter 11). The Always option also enforces validation when you import data in bulk (page 837). 252 FM P : T M M Validation Options UP TO SPEED Validation Messages Custom validation messages (like the ones in Figures 6-6 and 6-7) give you a chance to communicate directly with whoever uses your database. If you don’t provide a custom message when you set up field validation, then FileMaker uses a generic message of its own. This message explains the validation option that’s being violated in language only a software engineer would love. This message may be con- fusing to whoever’s using your database. By writing your own messages, you can explain things in a way that relates to the exact type of information with which you’re dealing. Custom messages make your database a pleasure to use, and give it a professional quality. Bear in mind, though, that although you can turn on as many validation options as you want, you can provide only one custom message per field. Unless you can depend upon your database users to enter the correct format every time, your message should explain exactly how to fill in the field. A message that says, “Your widget description is inval- id” gives your database users no indication of how to fix the problem, and prevents them from getting their work done. Validation Requirements When you added validation to the Zip Code field (see page 248), you asked File- Maker to accept only numbers and allow only five digits. But data type and character count are just two of the eight kinds of validations File- Maker has up its sleeve. In the Field Options window’s Validation tab, you have six more checkboxes. Most of them work much the same way: They compare what you type against some specific condition. But one option, “Validated by calculation”, of- fers a completely flexible way to describe exactly what you’re looking for. Unfortu- nately, to use it, you need to learn how to perform calculations (mathematical or logical formulas) with your FileMaker data. They’re covered starting in Chapter 8. Until then, here’s what the other options do: Strict data type This option lets you pick one of three specific validations. You’ve already seen “Nu- meric only”, which insists every character in your text field be a number. “4-digit Year Date” tells FileMaker to expect a date value, and that the year has to be four dig- its long (2012 instead of 12). This choice works with text, date, and timestamp fields. “Time of day” tells FileMaker that only time values that represent real clock times are acceptable. Since time fields can hold any number of hours, minutes, and sec- onds, you can enter something like 237:34:11 to mean “237 hours, 34 minutes, 11 seconds.” But if the field is supposed to be the time of your lunch meeting, that value doesn’t make sense. This option prevents its entry. It applies to text and time fields (timestamp fields always require a time of day). 253  :   Validation Options Note: The “4-digit Year Date” and “Time of day” options also work on Number fields. Not empty If you insist on having something in a field, select the “Not empty” validation option. This option makes FileMaker complain if you try to commit the record without entering something. This option and “Validated by calculation” are the only options that let you validate Container fields. Unique The “Unique value” option prevents you from putting the same value in a field for two different records. It comes in handy for things like product codes, account names, and course numbers. Existing value “Existing value” is just the opposite of “Unique value”; it doesn’t allow any value that isn’t already in that field on some record in the database. Imagine you’ve been us- ing a Book database for a while, and you’ve built up a representative list of Category values. You can turn on the “Existing value” validation option for the Category field to be sure any books you add in the future get one of the categories you’ve already specified, so that typos are prevented. This option doesn’t make sense until after you’ve put data in your database. Like all the field options, you’re free to turn it on or off whenever you want. Member of value list You can attach value lists to fields to restrict data entry to the values in the list (page 116). But you can also make that list a validation requirement. You’d usually do that if your users have found a way around using your value lists (like using a field on another layout that doesn’t have a value list attached to it, for instance). That way, even if the value list doesn’t appear on the field, you can set the validation message options as a tighter control over data input. When you select the “Member of value list” option, a pop-up menu becomes avail- able, from which you can choose which value list to use as a validation. You can choose an existing value list, or use the Manage Value Lists command in the pop-up menu to create a new list. In range “In range” lets you specify a minimum and maximum allowable value. FileMaker then protests if you enter a value outside this range. This method works for all the stan- dard data types, since they all have a concept of order. For example, if you specify a 254 FM P : T M M Storage Options range of Adam to Johnson for a text field, validation fails for Schultz. Range valida- tion is most common, however, with number, date, and time values. You can require the Age field to be between 0 and 100, for example, or the Birth Date to be between 1/1/1900 and 12/31/2015. Maximum number of characters As previously mentioned, this option enforces a limit on the number of characters you can enter into a field. FileMaker fields can normally hold a huge amount of text. This option lets you keep things under control. You can use it to require specific kinds of information, like the five-digit Zip code above, or to prevent abuse of the database (for example, by limiting the First Name field to 30 characters so someone doesn’t get carried away and paste the complete works of Shakespeare into it). WORKAROUND WORKSHOP Minimum Number of Characters For some strange reason, FileMaker doesn’t provide a simple validation option to enforce a minimum number of characters in a field. If you need this sort of thing, then you have to dip into validation calculations. Luckily, the calcula- tion to do it is really simple. Here’s a validation calculation for requiring at least five characters in the field: Length(My Field) >= 5 To use this calculation, in the Validation tab, turn on the “Vali- dated by calculation” option. In the window that appears, type the calculation. You have to change “My Field” to the name of your field. If you want a number other than five, simply change it in the calculation. When you’re done, click OK. If you want more than five characters, change >= to >. If you want exactly five characters (no more, no less) then change >= to =. You don’t need a lot of expertise for this calculation. If FileMaker gives you an error, and you can’t figure it out, just click Cancel, and then try again. (See Part 4 for much more on using calculations.) Storage Options It’s time to get a little technical. Sorry. In the Field Options dialog box, the Storage tab (see Figure 6-8) lets you control aspects of a field related to the nebulous concept of storage. Like a highly organized attic, FileMaker both holds onto your informa- tion and makes it easy to take out again. Lots of things determine how FileMaker compartmentalizes and maintains that information. You can actually tell FileMaker to store only one value in a field, no matter how many records you have, or to allow one field to hold more than one value in each record. Strange, but true. Also, you get control over indexing, as described in the next section. 255  :   Storage Options Figure 6-8: The Storage tab is where various behind-the-scenes field settings lurk. Here, you can make a field Global so it has only one value for the whole table, or make it Repeating so it has several values in each record. Many of these options are most useful when writing scripts (Chapter 10) or for very advanced purposes. Global Storage “A field that uses global storage contains only one value that is shared across all records.” So says the explanatory text in the dialog box, but what’s that in English? When you use the “Use global storage” option, everything you learned about tables goes out the window. A global field isn’t like a column in the table at all. Rather, it’s a single bit of storage that can hold one value, no matter how many records you have. In other words, if you change the contents of a global field on one record, then File- Maker instantly changes it in every other record as well. Now every record has the same value for that field. (You’ll learn a lot more about why you’d want to do this on page 575.) Repeating Fields A field can hold only a single value, right? Well, not really. If you want to, you can turn any field into a repeating field. These fields can hold more than one value, each kept in a separate spot (and each shown in its own little box in Browse mode). In the Storage tab section of the Field Options dialog box, you specify the maximum number of repetitions the field can hold. When would you want to use repeating fields? Almost never for normal data storage. See the box on page 256 for more info. 256 FM P : T M M Storage Options Note: The last tab in the Field Options dialog box applies only to Japanese text entry, and isn’t covered in this book. Fortunately, should you ever need to add Furigana to your kanji, you can read how right in the dialog box. WORKAROUND WORKSHOP Repeating Fields: No Substitute for Related Tables With very few exceptions, repeating fields cause more trou- ble than they’re worth. The truth is, they exist only because years ago when FileMaker was a youngster, it wasn’t a re- lational database. That means it didn’t have any way to tie multiple tables together so that they could share informa- tion and make connections between things in each table. In a database that’s not relational (called a flat file database), you have no good way to track lots of different kinds of entities in one database, so in the bad old days FileMaker came up with the concept of repeating fields to let you store more than one kind of thing in a single record. For example, you could have an Invoice table with one record for each invoice. The line items on the invoice needed a place to live too, so you created repeating fields. That way, each individual invoice could hold, say, 20 invoice items. But this is the 21st century, and FileMaker’s come a long way. Nobody in her right mind would build an invoice da- tabase that way anymore (she’d hook together two tables instead—see page 143). Since FileMaker had repeating fields 15 years ago, and since it’s really friendly about sup- porting all your ancient databases, it still supports repeating fields today. That said, repeating fields are occasionally useful when writing calculations (Chapter 8) and scripts or for some very advanced uses like storing temporary data in arrays or storing resource graphics for use elsewhere in your file. Other than that, you should avoid them when storing most data for a few reasons: • Repeating fields are uniquely FileMaker. If you want to take data out of your database and put it in some other program (like a spreadsheet or another data- base program), repeating fields can produce one se- rious pain in the neck. Likewise for getting data from other programs into repeating fields. • Repeating fields are inherently limited: If you create a field with 20 repetitions, then you get 20 spots for data. If you need less, you’re saving space for empty fields all the time. If you need more, you have to modify your fields, and then make room on your screen. A relational database, on the other hand, can grow and shrink as needed without modifying the database structure at all. Indexing Since you’re reading this book, you’re probably hoping FileMaker can help you search through volumes of information faster than you could do it yourself, espe- cially as your database grows from a simple electronic Rolodex to a humongous mailing list. When you’re looking for the three people out of 5,000,000 whose birth- day is February 29, FileMaker can find them in an instant because it doesn’t really look at the birthday field on each record one by one. Instead, it uses the field’s index to skip straight to the appropriate records. It’s similar to the way you’d use a book’s index to go directly to the pages that mention the topic you’re interested in, rather than skimming every single page in the book. 257  :   Storage Options Note: FileMaker uses a field’s index in other ways, too. You need an index if you want to use the “Unique value” option in the field Validation screen. You also need indexed fields to create relationships between table occurrences in your database (page 143). FileMaker’s indexing feature takes its own computerized notes about the data in your fields in advance, so that when you enter Find mode, the hard work’s already been done, and your finds go that much faster. Just like a book, you can have a field without an index. When FileMaker needs to find records based on what’s in that field, it has to check every single record—a pro- cess that can take noticeably longer in big databases. But indexing has tradeoffs, as explained in the box below. FREQUENTLY ASKED QUESTION The Dark Side of Indexing If indexing makes searching faster, why not just index ev- ery field? Indexes have disadvantages as well. An index is useful only if it’s up to date. When you change a field value, FileMaker has to store that new value in the table. If the field is in- dexed, FileMaker has to change the data you’ve typed, and it also has to update the index so that it knows about the changes to the field. Updating the index takes time (not much time, mind you, but it does take time). When you’re editing records in Browse mode, you never notice because updating the index for a handful of fields takes FileMaker less time than it takes you to realize you’ve pressed Enter. But if you’re entering lots of infor- mation (like when you’re importing records, as discussed in Chapter 19), then the index updating can slow things down noticeably. Also, indexes take up space. A database file that has index- ing turned on for every field could be much larger than the same file without indexes. For most users, this isn’t an issue, but if you have a very large file, and saving space is a priority, you can turn off indexing where you don’t need it, to save space. Automatic indexing The good news is you almost never need to think about indexing. FileMaker has a really smart way of dealing automatically with indexing: Every field starts out with no index at all, to save space and keep things as lean as possible. Later, while you’re working with your database, if you do something that would be made faster with an index, like use the field in a find request, then FileMaker automatically turns indexing on for you. That first find is slow since FileMaker looks through records one by one and builds the index (showing a progress bar in really big files), but once the field is indexed, subsequent finds happen quickly. You almost always want this automatic behavior. 258 FM P : T M M Storage Options Controlling indexing manually In very large databases, there may come a time when you want to adjust indexing manually. For instance, if you know you only very rarely search by a person’s middle name, you can tell FileMaker not to index that field. Searches that include that field are slow, but that’s OK since you hardly ever do it. On the Field Options Storage tab, select None to turn indexing off for any field. If you want to be able to search efficiently in a field, turn on All instead. The third choice—Minimal—creates a smaller index for the field. This index has everything FileMaker needs for relationships and field uniqueness, but not enough for fast searching. If you don’t need to search in a field, but you do need it indexed for other reasons, choose Minimal. When None is selected, you can keep FileMaker’s automatically-turn-it-on-when-I- need-it behavior by turning on “Automatically create indexes as needed”. Note: FileMaker uses the field index when you do a find from Find mode, but not when you use the Find/Replace command. The index points FileMaker to records, and since Find/Replace doesn’t find re- cords (it finds text inside a record or records), the index does it no good. Therefore, when you do a Find/ Replace, you don’t make FileMaker automatically index a field. Several actions trigger indexing, including using the field in a find request or value list, turning on Unique or Existing validation, and using the field in a relationship (page 143). POWER USERS’ CLINIC Put Automatic Indexing to Use FileMaker’s ability to automatically index a field when it becomes necessary doesn’t just save you the trouble of thinking about all this stuff. You can also use it to your advantage in some situations. Sometimes people need to distribute databases full of information. For example, suppose you have a large parts catalog that’s stored in a database, and you want your distributors to be able to use the database themselves to find parts. You can make a FileMaker database available on your website for them to download, complete with your 10,000 parts records. If there’s a lot of information about parts, then that data- base is pretty big. To make the download more palatable, tell FileMaker not to index any of the fields. But leave “Au- tomatically create indexes as needed” turned on. This way, the database is as small as possible when people down- load it. However, once they get it, they can start performing finds, and FileMaker automatically indexes fields, making searches faster, and ballooning the size of the database. Indexing language To keep its indexes as small and tidy as possible, FileMaker doesn’t actually store all a field’s text in the index. Instead, it performs a little cleanup on the field values first. Most notably, it gets rid of the notion of uppercase and lowercase letters: “Peter” and “peter” become the same entry in the index. [...]... from the hard drive If the command isn’t available, check to make sure you have QuickTime installed on your computer 2 64 FileMaker Pro 11: The Missing Manual Beyond Text: Container Fields Note: Unlike pictures and files, FileMaker never stores QuickTime movies in the database Instead, the program remembers where the original file is on your hard drive, and loads the data from it as needed As with other... through the pages in the PDF: Fast Forward goes to the next page, Rewind goes to the previous page If you press Play, FileMaker flips through the pages one after the other until it reaches the end of the document If you need to search text within a PDF file, try this Open the PDF file, select all the text, copy it, and then paste it into a regular text field Now, FileMaker can search the contents of the. .. out again (after all, the file is on your hard drive somewhere) Instead, double-click the container field to open the original file in the appropriate program 268 FileMaker Pro 11: The Missing Manual chapter 7 Layout Tools I n Chapter 3, you learned how easy it is to lay out a database using FileMaker s tools You can start out with one of the program’s Starter Solutions, and then customize it by moving... way the graphical embellishments you see on the top of the layout in Figure 4- 15 print only at the top of the first page, leaving more room for record data, and using less ink Here’s how to fix it: 1 If you haven’t already, go to the People Detail layout, and then switch to Layout mode You’re now ready to work on your layout 2 74 FileMaker Pro 11: The Missing Manual Layout Parts 2 Choose Insert➝Part The. .. details about a person 4 Click OK, and then, in the Layout bar, click Exit Layout When you click Exit Layout, FileMaker asks if you want to save the change you’ve made to the layout 5 Click Save Now the Layout pop-up menu shows the new layout name 280 FileMaker Pro 11: The Missing Manual Layout Types Layout Setup button Figure 7-8:  When you switch to Layout mode to edit a layout, the Layout bar turns... fills up the page Right: Every page thereafter shows the Header and Footer instead of the Title Header and Title Footer If you don’t have a Title Header, then you get the regular Header on the first page, too (and the same goes for the Title Footer) Also notice that the Trailing Grand Summary appears after the last record Just like List view, the Grand Summary parts place themselves before the first... Switch to the People List layout Nothing new here You see your records in a list 2 Perform a simple find For instance, find someone by first name The list changes to show only the matching records 3 Click one of the records Even when you’re in List view, FileMaker has the notion of a current record 282 FileMaker Pro 11: The Missing Manual Layout Types Since you can see several records at once, the program... Once the text is back in a text field or a word processor, you can edit the text again Insert➝Picture Copy and paste is simple, but sometimes doesn’t work cross platform, plus it doesn’t let you store only a reference to the file To get more control, use the Insert➝Picture command Here’s how: 262 FileMaker Pro 11: The Missing Manual Beyond Text: Container Fields 1 Click in the Graphic field It’s on the. .. options You can do the same thing by dragging the Part tool from the Status toolbar or choosing Insert➝Part 272 FileMaker Pro 11: The Missing Manual Layout Parts Figure 7-2:  The Part Setup dialog box is a catchall for the options pertinent to layout parts You’ll find it especially useful for rearranging parts of your layout To see the part definition for an existing part, select it in the Part Setup dialog... off, FileMaker copies the actual file into your database You can move or delete the original file and the data will still appear in the field, because the database now contains all the inserted file’s information If you turn on “Store only a reference to the file,” FileMaker doesn’t copy the file into the field at all Instead, it just remembers data about the file you select, including its name and the . it in some other program (like a spreadsheet or another data- base program), repeating fields can produce one se- rious pain in the neck. Likewise for getting data from other programs into. balloon, the path to the graphic is stored. The picture will still show in the con- tainer field, however. See the box on page 265 for information that’ll help you. 4. Click Open. FileMaker grabs the. that the real contents of the field is a text version of the path you showed FileMaker when you selected the file. So if the file is edited, your container field will display the changes in the

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 7. Layout Tools

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

Tài liệu liên quan