Using Calculation and Summary Fields


You cannot enter anything directly into a calculation or summary field. Instead, the fields store and display the results of calculations you build via the Specify Calculation dialog box or the Options for Summary Field dialog box.

Formulas used to define a calculation field can be as basic or as complex as you need and will seldom use every tool available in the Specify Calculation dialog box. Our first example walks through a very simple formula.

To define a calculation field

1.

To create a calculation field, choose File > Define > Database ( in Windows or on the Mac).

2.

When the Define Database dialog box appears, type into the Field Name text box the name of your field.

3.

Select Calculation from the Type drop-down menu, then click Create (Figure 9.31).

Figure 9.31. Once you create a new field, select Calculation from the Type drop-down menu and click Create.


4.

The Specify Calculation dialog box, where you define a formula for the selected field, appears. The simple Cost per square foot example uses just two field references and a single symbol: (sales price/square footage).

Add the sales price field reference by double-clicking its name within the list (Figure 9.32). Now click the division symbol (/) in the symbols keypad (Figure 9.33). Back in the left-side list, double-click the square footage field reference. (For information on using the Storage Options button in the Specify Calculation dialog box, see To store calculation results on page 123.)

Figure 9.32. Use the Specify Calculation dialog box to create your formula, then click OK.


Figure 9.33. The Specify Calculation dialog box's formula operators are controlled by the keypad and the scrolling window.


5.

Once you're finished building the formula, click OK to close the dialog box.

6.

When the Define Database dialog box reappears, click OK to close that dialog box.

Tips

  • Instead of mouse-clicking on the symbols keypad within the Specify Calculation dialog box, you can use their equivalents on your keyboard.

  • Selecting the Do not evaluate if all referenced fields are empty checkbox keeps FileMaker from performing a calculation unless the field referenced by the formula has a valuesaving some otherwise wasted time.


To edit a formula

1.

To reach the Specify Calculation dialog box and edit a formula, choose File > Define > Database ( in Windows, on the Mac). When the Define Database dialog box appears, double-click on the name of the calculation field whose formula you want to change.

2.

The Specify Calculation dialog box shows the formula in the center box. If you want to start fresh, double-click on the formula, then press or simply click on the first piece of the new formula (usually a field reference).

To edit individual parts of the formula, highlight that piece, and then click the replacement field reference, operator, or function.

3.

When you've finished editing the formula, click OK, then click OK when the Define Database dialog box reappears.

Tip

  • If you ever change the name of a field, you don't need to manually edit the formulas that reference that field. FileMaker automatically updates the field references in formulas to reflect any field name changes.


To change the display of calculation results

1.

First create a calculation field and build a formula for it. (See To define a calculation field on page 119.) Now click the Calculation result is pop-up menu (Figure 9.34).

Figure 9.34. Use the Calculation result is pop-up menu in the Specify Calculation dialog box to control how the results are displayed.


By default, FileMaker displays the results of a calculation as a number, which is what's needed in most cases. However, there are formulas that may need to be displayed as text, a time, a timestamp, or even a container. Make your selection and release the cursor.

2.

Click OK. When the Define Database dialog box reappears, click OK to close the dialog box.

To repeat a calculation field

1.

Choose File > Define > Database ( in Windows, on the Mac).

2.

Within the Define Database dialog box, double-click on the name of the calculation field you want to repeat. When the Specify Calculation dialog box appears, just enter a number in the Number of repetitions text window near the bottom of the dialog box. Click OK.

3.

When the Define Database dialog box reappears, click OK to close the dialog box. Remember: The appearance of a repeating field doesn't change until you format it. See To format a repeating field on page 113.



FileMaker Pro 8 for Windows and Macintosh(c) Visual Quickstart Guide
FileMaker Pro 8 for Windows & Macintosh
ISBN: 032139674X
EAN: 2147483647
Year: 2006
Pages: 184
Authors: Nolan Hester

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net