Anvil Community Forum

Notification when removing a row, which is linked to another table

Hello,

I removed an user from my user table manually, but the other table, which contains linked users to each row did not remove the rows, which contained the removed user.

This caused a databinding error in my repeating panel, whenever it tried to load the data from other tables, which contained the previously mentioned deleted user row. The error message stated, that the Row was removed, but could not help in finding the issue.

It would be useful to have a notification before deleting a row, that this row is linked to another row/rows in these tables, or have the possibility to automatically remove the rows, which contain the specified row.

2 Likes

Several ON DELETE options are potentially useful here:

  1. CASCADE (remove the entire row that references the deleted row). This could trigger a cascade of deletions, so it’s often not the best option.
  2. SET NULL (keep the referencing row, but set its reference to None).
  3. List all the references, so you can make an informed decision.

I’m sure you can think of others.