VISUAL QUICKPRO GUIDE FileMaker Pro 7 Advanced FOR WINDOWS AND MACINTOSH [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

VISUAL QUICKPRO GUIDE FileMaker Pro 7 Advanced FOR WINDOWS AND MACINTOSH [Electronic resources] - نسخه متنی

Cynthia L. Baron, Daniel Peck

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید

Creating Field Masks


Many database programs have the ability to format data like phone numbers automatically. If you enter 2125551234 in the phone field, youll see (212) 555-1234 instead. FileMaker Pro 7 does not offer this feature, but you can mimic it in a layout. If you place a locked, formatted display field directly over an unlocked entry field, you mask the bottom field but still leave it active. Connect the two fields with a calculation, and whatever value you enter displays properly in the field above it.

To create a field mask



1 .Go to a layout with a field youd like to mask. Choose File > Define > Database (Control+Shift+D/Command+Shift+D).

2 .When the Define Database dialog box appears, click the Fields tab.

3 .Select your existing field and change its type to Number if it was created as a Text field. This example uses the Phone field (Figure 3.60).

Figure 3.60. To format a phone number, it must be a Number field.

[View full size image]

4 .Create a new field and add the word Mask in the Field Name line (like Phone Mask or Credit Card Number Mask). Select Calculation as the type and click Create (Figure 3.61).

Figure 3.61. After youve verified that your Phone field is a Number, create a new field for your mask by choosing Calculation as the type and clicking Create.

[View full size image]

5 .When the Specify Calculation dialog box appears, click the quotes button and type (between the quotes (Figure 3.62).

Figure 3.62. To make a parenthesis appear before the phone number, type it between quotes.

6 .Click to the right of the quotes and then click the ampersand button (Figure 3.63). Double-click Left in the function list on the right to add it to the calculation in the formula box (Figure 3.64).

Figure 3.63. Click the ampersand (&) operator button to link functions together.

Figure 3.64. The Left function counts characters from the left of the field to separate them from the rest of the field contents.

Left will format the area code of the phone number by separating the first three numbers from the rest of the contents of the field.

7 .Double-click "text" in the Left calculation to highlight it, then double-click Abs in the function list. "Abs" will replace "text" in the calculation (Figure 3.65).

Figure 3.65. To replace a parameter with a function, select the parameter in the formula box, then double-click the function in the function list.

If the user enters a parenthesis at the beginning, FileMaker will assume that the number is a negative. The Abs function will return the entry as a positive.

8 .With "number" highlighted in the formula box, double-click Phone in the field list (Figure 3.66).

Figure 3.66. With the "number" parameter of the Abs function highlighted, select the field you want to connect to your mask.

9 .Highlight "numberOfCharacters" and type 3 (Figure 3.67). The number parameter specifies how many numbers the Left function should put inside the parentheses. Since this is an area code, you type 3.

Figure 3.67. To specify how many numbers should display after the first parenthesis, replace the parameter with that quantity. (For an area code, type 3.)

10 .Move your cursor to the end of the formula. Click the & operator button, then the quotes operator button and type ) inside the quotes.

11 .Move your cursor to the end of the formula and click the ampersand button. Add the Middle function by double-clicking it in the right functions list (Figure 3.68).

Figure 3.68. To add a function to a series of calculations, click the & button and then double-click the formula from the function list.

The Middle function works like the Left function, but instead of counting from the far left, begins counting at whatever character number you type in the "start" parameter, for the number of total characters you specify in the "numberOfCharacters" parameter.

12 .Use copy and paste to replace "text" in the Middle function with "Abs(Phone)" from the first part of the calculation.

13 .Double-click "start" and replace it by typing 4, then select "numberOf Characters" and replace it by typing 3 (Figure 3.69). To designate the second part of the telephone number, the 4 specifies the fourth number in the sequence (in other words, after the area code). The 3 specifies how many digits will follow.

Figure 3.69. To specify the second part of the telephone number, replace "start" with 4 and "numberOfCharacters" with 3.

14 .Move your cursor to the end of the formula. Click the ampersand button and then the quotes button. Type a hyphen (-) between the quotes

15 .Move your cursor to the end of the formula, then click the ampersand button. Add the Right function by double-clicking it in the function list.

16 .Replace "text" with "Abs(Phone)" again, then double-click "numberOfCharacters" and replace it by typing 4.

17 .Make sure your calculation result is set to Text, then click OK (Figure 3.70). When youre ready, click OK to close the Define Database dialog box. Youve finished creating the Mask field.

Figure 3.70. After completing your formula, click OK.

[View full size image]

18 .Go to the layout where you want the formatted field and switch to Layout mode (Control+L/Command+L).

19 .Select your Phone field, or add it if necessary.

20 .Duplicate the field by clicking and dragging it while holding down the Alt (Windows) or Option (Mac) key.

21 .In the Specify Field dialog box, uncheck "Create field label" and select Phone Mask from the list (Figure 3.71), then click OK.

Figure 3.71. To avoid creating an unnecessary field label, uncheck the "Create field label" check box when you add the Mask field to your layout.

[View full size image]

22 .While the Phone Mask field is selected, choose Format > Field Behavior (Control+Alt+K/Command+Option-K).

23 .When the Field Behavior dialog box appears, uncheck "In Browse mode" and "In Find mode," then click OK (Figure 3.72).

Figure 3.72. Prevent a user from entering a field by unchecking the options in the "Allow field to be entered" section of the Field Behavior dialog box.

This prevents the user from entering the Phone Mask field and getting a data entry error, since this field is a calculation and cannot be modified. When the user clicks on this field, the cursor will actually go into the entry field behind it.

24 .Make sure that the Fill for the Mask field is set to opaque (Figure 3.73).

Figure 3.73. Setting the Mask field to opaque prevents the entry field beneath it from showing through.

25 .Drag the Phone Mask field so that it is squarely on top of the Phone field.

When you switch to Browse mode and click on the Phone Mask field, the cursor will actually be in the Phone field.

/ 227