0

Delete a record and related records in other tables

I have a table named « Accounts » which is the main table where I add all my customers.

From the Accounts table, I created a Yes/No field which has the mission of deleting the selected account (record) when I modify the field to Yes. Deleting the record works well with the command :

delete this;

I also have other tables that are linked to the accounts table. For example, the "Activities" table.

When I launch the procedure for deleting an account, I would like all the records in the Activities table that are linked to be deleted as well.

Is it possible to do this?

Thanks for your help.

5 replies

null
    • John_Halls
    • 1 yr ago
    • Reported - view

    This is a feature of Ninox and is achieved by setting Composition to Yes on the link to other tables. Deleting a parent will then also delete any children, plus on the parent you can only add new children, not link existing ones, as it assumes there are no orphans (children without a parent)

    Regards John

      • Créateur de bien-être
      • Sebastien_Guillet
      • 1 yr ago
      • Reported - view

       Thanks, I didn't realize it was related that way. I will adjust the database.

    • Fred
    • 1 yr ago
    • Reported - view
     said:
    I created a Yes/No field which has the mission of deleting the selected account (record) when I modify the field to Yes.

     Wow, you are a very trusting guy. I wouldn't trust myself to not to be too impulsive and switch the field to Yes and then realize that is not what I should have done.

      • Créateur de bien-être
      • Sebastien_Guillet
      • 1 yr ago
      • Reported - view

       I "secured" with a dialog box to confirm deletion. The deletion is canceled by clicking "No".

      • Fred
      • 1 yr ago
      • Reported - view

      that is good. I didn't see it in your code.

Content aside

  • 1 yr agoLast active
  • 5Replies
  • 118Views
  • 3 Following