Cascading Deletes Are Transactional in FileMaker Pro
Cascading deletes can be a blessing when used properly, and I use them quite often. I do know though, that many people are scared of implementing them, and rightly so. They are a powerful tool that can absolutely wreak havoc on your data if not used carefully and properly. When used correctly however, they can take care of some of your cleanup work for you, and make sure that no orphaned records are left behind.
Something to be noted about cascading deletes that doesn’t come to mind very often, is that they are transactional (or at least seem to be within FileMaker Pro). What I mean by this is that if a user deletes a record in your database, then that record doesn’t actually get deleted unless it’s able to delete all of the child records that are supposed to be deleted with it as well.
In case that still doesn’t make sense, let’s use the simple CRM relationship above as our example.
Example A)
A user of this CRM system tries to delete a company record, but there is a record representing one of the people who work at that company being edited (either by another user, or even by the same user in a different window). At this point in time FileMaker will not be able to fulfill the cascade delete promise that it had agreed to when the developer put the checkmark in the yellow highlighted box above, and so it will return an error code of 301. It will not delete the company record, nor the people records at this time.
Example B)
A user of this CRM system tries to delete a company record, but this user does not have permission to delete people records. At this p0int in time FileMaker will not be able to fulfill the cascade delete promise that it had agreed to when the developer put the checkmark in the yellow highlighted box above, and so it will return an error code of 200. It will not delete the company record, nor the people records at this time.
These kinds of errors have popped up for me before, and actually caught be off guard.
When you really think about it though, this kind of logic makes a lot of sense, and it’s one more reason why you should learn about, and embrace cascading deletes in your system.
Comments