How to delete row in one sheet and automatically delete an associated row in another sheet

Hello, I have a very simple question.

I have two sheets that are associated, where if a user populates one of the sheets, the other one gets populated with that information using the “add row” feature.

Now, I noticed that if the user decides to delete the information from the first sheet (using the “delete row” button), the second sheet does not get deleted automatically (and vice versa).

Since this is a “delete” function, I cannot set column value to notify the other sheet that the information from the first sheet has been deleted.

How do I send a command to delete the row that was added in the second sheet when the original row in the first sheet has been deleted (and the reverse)?

Any help is greatly appreciated! Thank you in advance.

You can create a relation and do a delete through that relation. So likely you’ll need a custom action that will first delete rows through the relation, and then delete the row in the main table.

1 Like

Thanks for the quick reply, Jeff.

I do have a relation set up, but the problem I am having is how to delete a row after setting up a relation. I know this is probably common sense to most people, but I am very new so would you mind explaining how to “delete rows through the relation”?

I have only set up relations in the past to associate values through lookups and rollups that I can select from the dropdown menu. And as far as I can see, there are no “delete row” options in the dropdown menu.

Also, my inquiry was whether deleting a row in the original sheet could automatically delete the row that was “added” in the other sheet - but if you are suggesting that one sheet should be deleted first “and then delete the row in the main table” does that mean there isn’t a way to automatically delete the other, associated row if the row in one of the sheets is deleted?

Thanks again.

What Jeff mentioned is the way you need to set up a custom action. While setting up Custom action, you need to make sure that when the button is clicked, the first action is to delete all rows in corresponding table using relation and then second step is to delete your main row

Otherwise, if you delete the main row first, there will no longer be a relation to corresponding table and those rows in another table will remain there. I hope that makes sense

1 Like

When you set up a delete row action on a button, you can select the relation as the item you want to delete.

Dear Jeff and Pratik,

Thank you for supporting me with this issue that I’m having.

I tried applying my interpretation of your suggestions but as you can see in the video, my attempts have been unsuccessful.

Could you kindly indicate what I am doing wrong here and how I might remedy the problem?

I appreciate your help.

1 Like

First question, do you absolutely need to store every edit submission as a row in a different table? I am thinking you can use a form instead, it might make more sense for your case.

On the Events details screen, I am thinking you can have a separate button that opens a new screen of the current item, to only serve the delete purpose. The delete screen can contain something like: “Are you sure you want to delete?” and then a button bar of “Cancel” and “Delete”. The “Delete” button would have a delete action pointing to the relation, providing you have set up the relation correctly. It would be great if you can show some screenshots on how you’re setting up the relation.

1 Like

ThinhDinh,

No, I don’t have to store every edit submission as a row in a different table. I realize now that that’s what I was doing by using the same form to edit/delete. So yes, I think it’s a better idea to open a new form and ask whether the user wants to delete and offer a choice as you mention.

In terms of what I’m doing with the relation - The Row ID in the Schedule sheet is copied onto the Meeting ID column in the Proposeddates sheet, which is how I am creating the relation between the two sheets. I wasn’t sure whether I only had to create a relation in one sheet or both, so I have a relation made in both for now.

I set up the delete button in the new form so that it deletes row through a “relation ProposedDates” but the button doesn’t display - just like before - on the form.

Thank you for your help!

I figured out that you can’t create a relation with another sheet that basically has the same information as the original sheet.

It was a problem of figuring out the relationship hierarchy and what I wanted each sheet to do and display.

It took an entire weekend but I’m glad I was able to accomplish what I set out to do.

Thank you for the assistance!

2 Likes

Theoretically you can, but I think you can just combine them into one table.

Glad you have it sorted!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.