The FileMaker Cascading Delete Breakdown

From Dwayne Wright PMP
Certified FileMaker Developer

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

Please Note: If you are viewing this page in a news feeder, the images may get munged up a bit. For the best experience, please visit the journal directly by clicking (here). 

FYI... I have to admit that I rarely use this feature but I do want to cover it because it is important. When I do use it, I color the table occurrences that have the cascading delete setting in red, so that I can identify them easily while viewing the FileMaker relationship graph.

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.


In the best ... worst case scenario ... your privilege set for a user can cause this setting to quit working. If you do not allow a user to delete records in the child table, the cascading delete will not work. So you think you are doing cleanup of related records, when you really are not.

As an alternative, you can have a privilege be able to delete records but take away the menu option that makes the Delete Record option available. Another option is to script the delete record setting and use the scripts ability to run under full access privileges during the execution of the script.


DANGER, DANGER WILL ROBINSON

In the worst... worst case scenario... it is possible for you to define a cascading delete in the relationships of two or more tables. As one record deletes it deletes the related one, which may delete more related ones and so on. It is possible to delete one record in one file and totally empty all records in both files. 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.


This setting will delete any records in a child file related to a parent record.

The point that I want to raise is that your security setting can cause this setting to quit working. If you do not allow a user to delete records in the child table, the cascading delete will not work.


There are ways to program around this but the most common method is to script the process of deleting records. In the case of a script, you can click a check box for the user to have full access privileges while the script is running. Once the script has finished its execution, the user goes back to the set security settings.

=
More info about the author and FileMaker in general, contact me at info@dwaynewright.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.