Database Reference
In-Depth Information
Other Steps that Work with Fields
Lots of times, you want to be able to write scripts that work on multiple records. You may
need to change values across a found set of records, or you may want to let FileMaker handle
the serial numbering of all the records in a table. The next script steps let you manage data in
lots of records without lots of hassle.
Replace Field Contents and Relookup Field Contents
The
Replace Field Contents
and
Relookup Field Contents
commands let you specify
a field to act upon. If you
don't
specify a field, then they act on the current field. You also get
the typical “Perform without dialog” checkbox. When you turn this checkbox on, the action
happens immediately when the step runs. If you leave this option off with the
Replace
Field Contents
step, then people see the typical
Replace Field Contents
dialog box
(with all the settings you specified in the script). With the
Relookup Field Contents
step,
they just see a confirmation message first, asking if they really want to perform the relookup
operation.
GEM IN THE ROUGH: A REUSABLE NOTES SEPARATOR SCRIPT
The mark of a FileMaker power-scripter is someone always on the lookout for the opportunity to
write
one
script that can be used in
several
places. After all, who wants to spend his life writing
scripts? The fact is, you're probably so happy with your new Notes field and its separator script that
you want to use it in other places—on a Job, an Invoice, a Payment, and so forth.
It would be much nicer if the Add Note Separator script could add a note separator (and place the in-
sertion point) in
any
field you wanted. That way you could tell people to click the field they want
before running the script to get the separator entered into the field of their choice.
The only thing tying your script to the Customers::Notes field is the “Go to target field” checkbox
on the
Set Selection
steps. If you edit the script and turn this option off for
both
Set Selection
steps, then it works on whatever field is active when the script runs.
If you don't like to have to click the field before running the script, then you can fix it in two ways,
but both require information you haven't learned yet. You'll get there in
Chapter 17
.
Set Next Serial Value
The
Set Next Serial Value
script step is invaluable—in the rare cases when anyone actu-
ally uses it. It's a one-trick pony: If a field auto-enters a serial number, then this step changes
the “next value” stored in the Field Options dialog box. In other words, if you want to start
your customer ID values over again, then you can use
Set Next Serial Value
to do it
from a script. (See the box on
A Reusable Notes Separator Script
for an example.)