From Dwayne Wright - www.dwaynewright.comThe Set Field script step is much like the Paste script step. Both steps replace the contents or add additional data to a field. The Paste step requires the target field to be on the current layout when it is executed. The Set Field script does not need to see its target field on the current layout, it can add data to any field including related fields using a valid relationship.
This script step has the two options of what field to execute upon and what specified value to put there. If you don’t specify a field when the script steps executes, it will perform on the currently selected field. The specified value option uses the FileMaker calculation engine, so it can be very robust and flexible in the value it uses.
The Paste command replaces the contents of a field with information in the computers memory /clipboard that was copied there. The Set script step does not do that. The Set command replaces the contents of a field with a calculated result. The clipboard is not affected by a Set Command.
Now the field type does play a role here. If you are placing a value in a field, you should try to make sure they are the same type (text to text, number to number, etc...). If you do not, you may get some unexpected and unwanted results! Field validation will not help you with the Set Field script step unless the validation is set to Always.
Other things to remember, the Set Field script step will enter into a field, thereby locking the record it is on (see record locking). Its changes will not be stored until you exit or commit the record (see commit record script step).
HOW IT IS USED
Primarily as a way to get around the limitations of the paste commands. It can also be used to store a variable by setting a global field equal to a calculated result ... and ... then in turn... use that global as a variable to set another field.
COOL IMPLEMENTATIONS OF IT
I've seen one implementation where the SET command put a picture in each repetition of a repeating field. By pausing the script between each SET command, you basically had a status bar activity animation.
FYI...
The SET command uses a calculated result. That result needs to be in the same format as the field being set ( text to text, number to number, date to date and so on).
One of the options is to select a field to have the SET command to act upon. Otherwise, it will attempt to SET the field the cursor is currently inside of.
Got To Know Factor - 9
=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.
© 2007 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.

