Reference > Script steps reference > Fields script steps > Insert Text
 
Insert Text
Purpose 
Pastes a text value into a field in the current record or into a variable.
See also 
Format 
Insert Text [Select; <table::field>; "<text>"]
Options 
Select entire contents replaces the contents of a field or variable. If you don’t select this option:
For a field, replaces only the selected portion of the active field, or inserts data at the insertion point. The default insertion point is at the end of the field's data.
For a variable that doesn’t have container data, inserts data at the end of the variable’s current value. For a variable that has container data, replaces the contents of the variable.
Target specifies the field to receive the pasted information or the variable to set. If the variable doesn’t exist, this script step creates it (see Using variables).
<text> is the exact value you want to paste.
Compatibility 
 
Where the script step runs 
Supported 
FileMaker Pro 
Yes 
FileMaker Server 
Yes 
FileMaker Go 
Yes 
Custom Web Publishing 
Yes 
FileMaker WebDirect 
Yes 
Runtime solution 
Yes 
Originated in 
FileMaker Pro 6.0 or earlier
Description 
You must specify a target variable, specify a target field on the current layout, click in a field, or use the Go to Field script step before performing this script step. If Target is not specified, the data is placed in the active field. Otherwise, this script step returns an error code that can be captured with the Get(LastError) function.
Notes 
This script step is intended to paste text into text field types. To insert other types of data into other types of fields, use either the Insert Calculated Result script step or the Set Field script step.
If you manually select field data before you run this script step in FileMaker WebDirect, the script step performs as if you did not make a selection. To select field data before you run this script step in FileMaker WebDirect, use the Set Selection script step.
Example 1 
Inserts "Draft" into the Status field.
Insert Text [Select; Invoices::Status; "Draft"]
Example 2 
Inserts either "Paid" or "Unpaid" depending on the value of the Payment Date field.
If [ IsEmpty ( Invoices::Payment Date )]
Insert Text [Select; Invoices::Status; "Unpaid"]
Else
Insert Text [Select; Invoices::Status; "Paid"]
End If
Example 3 
Inserts "Draft" into the Status field or displays a dialog box if Status is not on the current layout.
Insert Text [Select; Invoices::Status; "Draft"]
If [Get ( LastError ) = 102]
Show Custom Dialog ["Status field is missing on current layout"]
End If
Related topics 
Script steps reference (alphabetical list)
Script steps reference (category list)