From Dwayne Wright PMP, PMI-ACP, CSM
Certified FileMaker Developer
A READER ASKS: I was reading your "FILEMAKER: The Set Field Script Step" and it sounds very clear however I'm not able to make it work. What I need is by pressing one button (executing a script) copy two values (numbers) from an active record of one layout and paste them to an active record of another layout.
I would prefer not to use the copy past option and I thought the Set Field Script would do it.
Can you help me?
DWAYNE RESPONDS: Well, the Set Field script step has no memory aspect to it. I would work fine for the same record using the same base table or setting a related record. I agree that you probably want to avoid copy and paste. First off, you cannot copy two values and paste two values (unless you make sort sort of data array and then parse it).
What I would suggest in your script is to use a script variable. Set two variables before you switch layouts and then set the fields you want equal to their variable values. Variables can be created and used in scripts and calculations.
Variables are useful in simplifying complex calculations, passing information from one process to another and opening doors to innovation within FileMaker design. So you can set a variable equal to some value, then do some other things and then reference that variable in a script or calculation.
For your needs, I think a local variable will do just fine. A local variable is defined by adding a single dollar sign in it’s name such as $InvoiceNumber, $ClientID or $Counter. A local variable will store its information within a script while that script is running. After the script is finished its execution, the defined local variable will have no value. An advantage of this is like a disposable lighter. When you are done, you throw it away because you never intend to refill it.
More info about the author and FileMaker in general, contact me at email@example.com.
© 2008 - 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.