Reference > Script steps reference > Editing script steps > Set Selection
 
Set Selection
Purpose 
Designates the starting and ending position of a selection in a field.
See also 
Format 
Set Selection [<table::field>; Start Position: <n>; End Position: <n>]
Options 
Go to target field specifies the field whose contents you want to select.
Start Position specifies the starting position of the selection.
End Position specifies the ending position of the selection.
Compatibility 
 
Where the script step runs 
Supported 
FileMaker Pro 
Yes 
FileMaker Server 
Yes 
FileMaker Go 
Partial 
Custom Web Publishing 
Yes 
FileMaker WebDirect 
Yes 
Runtime solution 
Yes 
Originated in 
FileMaker Pro 6.0 or earlier
Description 
The starting and ending values can be typed in directly or determined via a calculation. If no target field is specified the current active field is used.
Notes 
Field position is determined by the number of characters, including spaces, beginning with position 1, the first character in the field. The selection includes all values beginning with the Start Position and concluding with the End Position. For example, if Field1 has the value "abcdefgh", and the script parameters specify a start position of "3" and an end position of "6", the script step will return the selection "cdef".
If the start position is valid and the end position out of range, everything from the start position to the end of the field is selected. If the end position only is valid, the cursor moves to the end position, and nothing is selected. If both start and end positions are invalid, the cursor moves to the end of the field contents.
No action is taken if the user attempts to perform a selection on a container field.
Data selected out of visual range is scrolled into view.
In FileMaker Go, this script step does not highlight selected text if the keyboard is hidden on the device.
Example 1 
Selects the first 5 digits of the Postal Code field.
Set Selection [Customers::Postal Code; Start Position: 1; End Position: 5]
Example 2 
Selects the number of paragraphs that the user specifies in the custom dialog box.
Show Custom Dialog ["How many paragraphs do you want to select?"; Products::Number of Paragraphs]
If [Get ( LastMessageChoice ) = 1]
Set Selection [Products::Description; Start Position: 1; End Position: Position ( Products::Description ; ¶ ; 1 ; Products::Number of Paragraphs )]
End If
Related topics 
Script steps reference (alphabetical list)
Script steps reference (category list)