Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 4812 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I often want to ensure that, if a user deletes a record in a parent table, all records in a related child table also get deleted (cascade delete). I can ensure this in the Edit Relationship dialog by checking the option "Delete related records in this table when a record is deleted in the other table".

What if I want to prevent the user from being able to delete a record in a parent table if that table has related records in a child table? What are my options? Is there a way to ensure this in the database schema or do I just have to rely on the scripted control of my user interface?

Posted

Set this up in the privilege set's record level access.

Posted

But that would stop them from deleting any record in a specified table under any circumstances and that's not what I want. I only want to stop them from deleting a parent record if it already has children.

Posted

No, that is not what Vaughan said. Specify in the calc for the RLA

Allow delete if

isempty ( relationship::_kF_ParentID) // there are no children

I usually script this. So, in my Delete script:

If ( isempty (relationship::_kF_ParentID) //there are no children

Delete Record

else

Show dialog "What about the kids?"

endif

Posted

In the Security section, you define record level access rules. If you have limited edit capabilities, then to define when a user can edit, you can enter a calc. See Help.

Posted

OK, I see it. That would work. Thanks

Now, would that enforce my referential integrity delete rule in all circumstances such as if the file was accessed by another external file?

Posted

The record level access restrictions are ALWAYS enforced as long as the file is opened with an account that uses them. That is, don't use the full access account.

This is difference between enforcing restrictions at the record level (using the security privileges) and using interface (scripting the delete command). The RLA security works even when the interface is in a different file.

Posted

That's what I wanted. I knew that enforcing RI at the interface level wouldn't be good enough in every situation.

This topic is 4812 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.