New FileMaker Child Records Via A Scripted Copy / Paste

From Dwayne Wright PMP
Certified FileMaker Developer

WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

This technique is a little long in the tooth and isn’t used that much anymore. That isn’t to say that it doesn’t work ... because ... it does work a huge majority of the time. It involves writing a couple scripts that copies the primary key data in the parent table. Then runs a script in the child table that creates a new record and pastes the information into the foreign key field. Then the script may return the user back to the parent file.

I didn’t create an example file for this technique for a couple reasons. For starters, it pretty much describes itself. The major reason for not building the example file is that this technique does have a few flaws. The script steps of Copy and Paste require the referenced fields to be on the current layout when a script is executed. For example, our script copies the data in the record id field. However, the developer removed that field from the main layout because he / she needed more space for another field. When the script runs, it goes to the layout to copy data from a field that is not there. So nothing happens during that step and ScriptMaker moves on down the line. You will not get an error message and may not know for some time that something went awry.

Another problem with scripted copy and paste steps is that it replaces the contents of the clipboard ( where the computer stores data you cut or copy ). So you may have just copied your password and it is in the computers clipboard. Then you run a script with copy / paste and the password data is either deleted or possibly pasted into somewhere is should not be.

A variation on this is to use a script variable. Setting a variable equal to a key value and then setting the child key data equal to that variable. That preserves the clipboard and is very useful when working with arrays.
=
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.