Database Reference
In-Depth Information
UP TO SPEED: SET FIELD VS. INSERT
FileMaker's field editing script steps have a lot of overlap. For example,
Set Field
with no target
field behaves the same way as an
Insert Calculated Result
step with no target field and the
“Select entire contents” checkbox turned on. And you can use
Insert Calculated Result
with
the appropriate calculation to do the same thing as
Insert Date
,
Insert Time
,
Insert Text
, and
Insert Current User Name
. In general, it doesn't matter one bit which one you use.
But you should think twice about using the Insert script steps with a target field specified
and
the
“Select entire contents” checkbox turned on. With both options set, these script steps simply over-
write the value in some field—exactly what
Set Field
does.
Since these steps need the field on the layout, though, they're more
fragile
: The script can break if
you make changes to a layout. You'll probably save yourself a headache tomorrow if you just use
Set Field
today.
Of course, if you're inserting
into
a field (without “Select entire contents” turned on), then it's easier
to use an
Insert
step. But it's best to use this step in a script that'll be run if someone is already in
the field. That way you know the field is on the layout and the step will run properly.
Finally, you can't accomplish some of the Insert steps from a calculation. Specifically, you can't ac-
cess the last visited record or the View Index dialog box from a
Set Field
step.
Using the Insert File Script Step
With great power comes great responsibility. There are so many options to choose when in-
serting files into container fields that unless you have a highly trained set of users, you usu-
ally won't let them insert files without a script that uses one of the steps above. The
Insert
File
script step is the most powerful and flexible of them all, and you'll use it to help users
make the right choice for inserting files. It has the option to specify a target container field
and a source file. But the “'Insert File' Options” dialog box (
Figure 12-4
) lets you create a
custom dialog box that can restrict the user to the choices you want him to see.