Set Field
Purpose 
Replaces the entire contents of the specified field in the current record with the result of a calculation.
Format 
Set Field [<table::field>; <value or formula>]
Options 
 •
Select Specify target field or click Specify to specify the field whose contents you want to replace. If no field is specified and a field is selected in Browse mode or Find mode, that field is used.
 •
For Calculated result, click Specify to define the calculation. In the Specify Calculation dialog box, type the calculation you want evaluated, or use the field list (on the left) and the functions list (on the right) with the mathematical and text operators to build the calculation.
Compatibility 
 
Where the script step runs 
Supported 
FileMaker Pro 
Yes 
FileMaker Server scheduled script 
Yes 
FileMaker Go 
Yes 
Custom Web Publishing 
Yes 
FileMaker WebDirect 
Yes 
Runtime solution 
Yes 
Originated in 
FileMaker Pro 6.0 or earlier
Description 
 •
The result of the calculation must match the field type. For example, you can't assign a date calculation to a container field.
 •
 •
If the result of the calculation doesn’t match the target field type, and the validate option for the field is set to Always, the field will not be set and an error code is returned (which can be captured with the Get(LastError) function).
 •
 •
Example 1 
Inserts the sum of the invoices' grand totals into the Statistics field.
Set Field [Customers::Statistics; Sum ( Invoices::Grand Total )]
Example 2 
Demonstrates when to use Set Field instead of Set Field By Name to simplify scripts.
#If the target field does not change, use the Set Field script step.
Set Field [Customers::Work Phone; Credit Collection::Phone Number]
#If you use Set Field By Name with a target field that does not change,
#you must surround the target field in quotation marks so it evaluates as a literal string
#and returns the specified field name. If you do not use quotation marks,
#Set Field By Name evaluates the specified field and uses the result as the target field.
#If the result does not specify a field name, nothing happens.
Set Field By Name ["Customers::Work Phone"; Credit Collection::Phone Number]
Related topics 
Set Field By Name script step
Defining calculation fields
Script steps reference (alphabetical list)
Script steps reference (category list)