Script Steps Reference

Table Of Contents
FILEMAKER SCRIPT STEPS REFERENCE 49
When possible, the Set Field By Name script step makes the record active and leaves it
active until the record is exited or committed. Scripts that use a series of Set Field By
Name script steps should group these steps together if possible, so that subsequent Set
Field By Name script steps can act on the record without having to lock the record,
download and upload data, index the field, and so on, after each individual Set Field By
Name script step. These functions and record-level validation are performed after the
record has been exited or committed.
Example 1
In the following example, a calculation identifies the target field in which a value should be replaced
based on the geographical location in which the data was entered. Then the script enters a
calculated value in the target field based on the appropriate currency exchange rate.
Set Field By Name
[If (Members::Country = "USA" ;
"Members::Fee Paid-USD" ; "Members::Fee Paid-GBP");
If (Members::Country = "USA" ;
Members::Fee*<USCurrencyRate> ;Members::Fee*<GBCurrencyRate>)];
Example 2
The following example replaces the contents of the Country field located in Table1 with the data
located in the Name field in related Table2.
Set Field By Name["Table1::Country";Table2::Name]
Note To ensure proper evaluation, FileMaker Pro must treat the target field as a literal string.
Therefore, you must include quotation marks around the calculated target field.
Example 3
The following example replaces the contents of the global target field with the data value located in
the Name field in related Table2.
In this example, Table1::FullName contains the literal value “Table1::FullName” and Table2::Name
contains “John Smith”. After the step completes, the value in “Table1::FullName” is “John Smith”.
Set Field By Name[“Table1::FullName”;Table2::Name]
Note The context for the calculation (determined in the upper left corner of the Specify Calculation
dialog box) is essential for proper evaluation.
Example 4
The following example uses the GetFieldName function to ensure that FileMaker Pro retrieves the
fully qualified name of the target field and the Evaluate function to extract the value stored in the
target field, then replaces the contents of fieldName with the data value located in the Name field in
related Table2.
Set Field By Name
[GetFieldName(Evaluate(Location::fieldName));Table2::Name]