Duplicate FileMaker Records With Related Records

From Dwayne Wright PMP - Certified FileMaker Developer
WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

Ok, this something you would think that you could do easy enough. When you duplicate a record in a FileMaker file, the related records are duplicated as well. You would think this would be some setting in the define relationship dialog box.

So ... just because FileMaker didn’t add this as a dialog box option, does that mean you cannot find a way to do it? If you are thinking ScriptMaker might be able to, you are correct!

So here is the steps you need to cook up this dish. I’ve seen a number of folks post ways to do this using an import process from one table to the next. As a general rule, I avoid importing records from one table to another. If something goes awry with the import and/or the resulting need to use a replace command always factor into my thinking.

This example is a rework of my original FileMaker 6 example. With it, I had two files (of course) and had to use global fields to pass the relational key data between the to fields. Describing the process took about two pages of text and pictures. This revised version of the example is a single file solution and uses local script variables. Using this new method, I don’t really feel the need to describe the technique because a snapshot of the script (with standard use of script commenting) does a pretty good job in itself.

Here you can see how I use a local variable and a looping script to duplicate a record and give the duplicate matching related records.

An example file can be downloaded by clicking (here)

© 2010 - 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.