Auto-Enter Calculations

Calculation fields are fantasticthey save time and ensure error-free results. But they have one serious limitation: You can't change their values. Of course you can adjust the calculation itself, but sometimes a field needs the capacity to override its calculated value on a record-by-record basis.

For example, it would be nice if your invoice's Date Due field automatically showed a date 30 days after the date of the invoice itself. But sometimes you might want to make an invoice due earlier or later, based on special circumstances (like a holiday). If you make the Date Due field a calculation field, you don't have this flexibility. The solution is to use a normal Date field with an Auto-Enter calculation (see box on Section 9.5).

Like all the Auto-Enter options (Section 3.3), an Auto-Enter calculation automatically fills in a field's value, but leaves it changeable. You can get all the accuracy and time savings of a calculation field, plus the power to change your mind. Here's how to put it to use:

  1. Bring up the Define Database window and switch to the now-familiar Fields tab. From the Table pop-up menu, choose Invoices.

    The fields from the Invoices table appear.

  2. Select the Date Due field in the list and click Options.

    The Field Options dialog box makes an appearance.

  3. On the Auto-Enter tab, turn on the Calculated Value checkbox.

    The Specify Calculation window appears. It looks just like it did before, but this time you're not creating a calculation field. Instead, you're specifying the calculation used to determine the auto-enter value.

  4. Create the calculation Date + 30.

    You can use any method you want to build this calculation: Click the field and operators, or type them. Notice that the calculation result is set to Date, and there's no pop-up menu to allow you to change that. Your calculation must resolve to a valid date, or FileMaker will squawk at you.

  5. Click OK three times to dismiss all the dialog boxes.

    You return to the database itself.

Now you can create a new invoice and test out your field. When you enter a Date for the invoice, the Date Due field updates instantly with the date 30 days from now. Notice that you can still change the Date Due field if you want.

Part I: Introduction to FileMaker Pro

Your First Database

Organizing and Editing Records

Building a New Database

Part II: Layout Basics

Layout Basics

Creating Layouts

Advanced Layouts and Reports

Part III: Multiple Tables and Relationships

Multiple Tables and Relationships

Advanced Relationship Techniques

Part IV: Calculations

Introduction to Calculations

Calculations and Data Types

Advanced Calculations

Extending Calculations

Part V: Scripting

Scripting Basics

Script Steps

Advanced Scripting

Part VI: Security and Integration

Security

Exporting and Importing

Sharing Your Database

Developer Utilities

Part VII: Appendixes

Appendix A. Getting Help



FileMaker Pro 8. The Missing Manual
FileMaker Pro 8: The Missing Manual
ISBN: 0596005792
EAN: 2147483647
Year: 2004
Pages: 176

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