Delete Parent FileMaker Record Deletes Related Child Records?
Monday, July 13, 2009 at 10:09AM From Dwayne Wright PMP - Certified FileMaker Developer
WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts
A READER ASKS
Two tables connected with the auto delete related records setup, what happens if the parent table is deleted from the graph entirely? Are the records that were related to the parent table deleted by the action of the table being removed. What about if just the table occurrence itself is removed by not the table?
-------
DWAYNE RESPONDS
When you define a relationship, you can define an option to delete related records when the parent record is deleted. This is a great way to cleanup orphaned related records when the parent record is deleted. It is a nice feature but I do ask that you consider the consequences of this feature about before implementing.

I haven’t run across a delete parent table with the associate related delete option enabled in the “real world” but your question is an excellent example of some questions that you should consider before implementing this setting. In my research of FileMaker blogs and books, I didn’t find this particular question addressed. So I decided to build an example file, set it up with the exact settings you described and give it a go. In the movie linked below, you will see that my tests seem to indicate that related records ARE NOT deleted if the parent table is deleted.

There is a related movie on this topic! CLICK HERE!
ABOUT CASCADING DELETES
Cascading Deletes is a term that is associated with the method of deleting all related records when a parent record is deleted in the parent table.

In the bottom third of the relationship setup dialog, you can see options to handle the relationship for the tables on either side of it. You can set it up so that you can add related records on the fly through the relationship. You can also automatically delete related records when a parent record is deleted. This is helpful because it helps eliminate orphan related records. However, all automatic deleting options should be carefully thought out before you implementation. You can even sort the related records for portals or which related record is shown for related fields on a layout.
CAUTION: It is possible to have an out of control cascading delete in this situation. It is possible that one deleted record can trigger multiple related record deletions until you have a snow ball effect. Be sure this setting is well planned out and tested before implementation.
Also your security account privilege setting can cause the auto related delete setting to quit working. If you do not allow a user to delete records in the related table occurrence, the cascading delete will not work. So you can have an option of allowing the user to delete records in that file and perhaps take away the menu option that makes the Delete Record option available. Another option is to build a maintenance script that cleans up orphaned records attached to another script or an after business hours timed script.
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.
© 2009 - 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.








