VISUAL QUICKPRO GUIDE FileMaker Pro 7 Advanced FOR WINDOWS AND MACINTOSH [Electronic resources]

Cynthia L. Baron, Daniel Peck

نسخه متنی -صفحه : 227/ 31
نمايش فراداده

Using Calculated Field Labels

When you design a layout, you usually include all fields that might be needed, even if some arent always used. Major changes are best handled by creating another layout, but there can be times when you only need to include (or exclude) a specific field. For instance, you might have designed an invoice layout that includes a discount field. You would only want that field and its label to appear if there is a discount. (Otherwise the customer will want to know why they didnt get one.) By creating a calculated field that contains both the value and the label, you can customize the layout to automatically display or hide the field.

To create a calculated field label

1 .Choose File > Define > Database (Control+Shift+D/Command+Shift+D).

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

3 .Type a name into the Field Name text box. Choose Calculation as the Type, and click Create (Figure 3.54).

Figure 3.54. You create a calculation field by giving the field a descriptive name, selecting the Calculation from the Type drop-down list, and clicking Create.

[View full size image]

4 .When the Specify Calculation dialog box appears, in the functions list on the right double-click If (Figure 3.55).

Figure 3.55. To place a function in the formula box, double-click it in the functions scrolling list. Functions are followed by parameters in parentheses that you can specify.

[View full size image]

5 .In the Discount Display area, replace "test" in the If calculation by double-clicking it to make it the only highlighted parameter, then double-click IsEmpty in the Functions list.

6 .With "field" highlighted in the calculation, double-click the field you want to designate in the fields list on the left side. This example uses the Discount field (Figure 3.56).

Figure 3.56. To specify what field to use in a calculation, double-click it in the field list on the left.

[View full size image]

7 .Double-click the parameter "resultOne" to select it, then click the quotes button in the Operators keypad (Figure 3.57).

Figure 3.57. The most frequently used operators are available via a keypad.

8 .Double-click the parameter "resultTwo" to select it, then click the quotes operator button again. Type the name of your label and a space between the trailing quotation mark. In this example, the label is "Discount" (Figure 3.58).

Figure 3.58. So far, this calculation says that if there is no discount, the field is empty, but if there is a discount, the word Discount should appear.

9 .Move your cursor between the last quotation mark and parenthesis and click the ampersand (&) operator button. Add the GetAsText function by double-clicking it in the right functions list.

10 .With "data" highlighted in the calculation, double-click the same field you chose in step 5. This example uses the Discount field.

11 .Move your cursor between the two closing parentheses. Click the ampersand button, then the quotes button, and type % between the quotes.

12 .Make sure to choose Text from the "Calculation result is" pull-down menu, and click OK (Figure 3.59). When youre finished, click OK to close the dialog box.

Figure 3.59. Click OK to save the finished calculation.

13 .Go to the layout where the new field will be displayed and switch to Layout mode (Control+L/Command+L).

14 .Add the new field to the layout.