Database Reference
In-Depth Information
The Options for Field dialog box makes an appearance.
POWER USERS' CLINIC: DO NOT REPLACE EXISTING VALUE
Auto-enter calculation fields don't act exactly like other calculation fields. If you change the
invoice date, the due date doesn't update to reflect the change. Instead, it keeps its original
value, as in the example on the previous page. That's normally the way an auto-enter calcu-
lation works: It acts only when you first create a record or if the field is empty. Once the
field gets a value, the calculation doesn't update it, even if the field it refers to changes.
Often, though, you want the calculation to change the field value every time any field used
in the calculation is changed, just like a normal calculation. You can easily get this modified
behavior by turning off the “Do not replace existing value of field (if any)” checkbox in the
Field Options dialog box (shown in Figure 9-9 ). When you turn this checkbox off ,
FileMaker dutifully updates the field value whenever the calculation evaluates—in other
words, when any field it uses changes.
You choose your option depending on the situation. For the Date Due field, you probably
want to turn this option off. After all, if you're changing the date of an invoice, it's reason-
able to assume you want to rethink the due date as well.
But suppose you have a database of products and you use an auto-enter calculation to copy
the distributor's product code into your internal product code field. If you then change the
internal product code to something unique to you, then you probably don't want it to change
again if you switch to a different distributor. In that case, you'd leave the “Do not replace
existing value of field (if any)” option turned on, ensuring that once you've put in your own
special value, it never changes.
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 operat-
ors, or type them. Notice that the calculation result is set to Date, and you don't have a
pop-up menu to let you change that. Your calculation has to resolve to a valid date or
FileMaker squawks at you.
5. Click OK three times to dismiss all the dialog boxes .
Now you can create a new invoice and then 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
Search WWH ::




Custom Search