# Deleting multiple rows - nesting

**URL:** <https://community.glideapps.com/t/deleting-multiple-rows-nesting/71418>\
**Category:** Ask for Help\
**Created:** [March 5, 2024, 8:17am UTC](https://community.glideapps.com/t/deleting-multiple-rows-nesting/71418 "2024-03-05T08:17:22Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_Hill](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/simon_hill/32/94730_2.png) [@Simon\_Hill](https://community.glideapps.com/u/Simon_Hill)\
**Post date:** [March 5, 2024, 8:17am UTC](https://community.glideapps.com/t/deleting-multiple-rows-nesting/71418/1 "2024-03-05T08:17:22Z")

</div>

I am using the delete multiple rows feature for the first time (yup, didn’t realize it had appeared!).

My question is: If the relation is empty, will the action be forbidden, despite subsequent steps being possible? See screenshot.

I want to delete the parent row in a table and all the related children rows. So in step 1 I delete the multiple child rows using the relation. Then in step 2 I delete the parent row.

However, I 'm concerned that if the parent has no children then the action will not be allowed and the parent will not be deleted. Or will Glide just skip the first step since it is an empty relation and execute the second?

I have noticed that sometimes buttons are not visible when the corresponding actions are not possible.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/e/9efda903e7999800cc230f0e08c1b37f43e8a7b9.png)

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 5, 2024, 8:49am UTC](https://community.glideapps.com/t/deleting-multiple-rows-nesting/71418/2 "2024-03-05T08:49:31Z")

</div>

The way to do this is as follows:

- Delete Row (children, via relation)
- Wait for condition (relation is empty)
- Delete Row (parent)

The wait is important, otherwise you risk the parent being deleted before all children are gone (and hence breaking the relation), leaving one or more orphans.

As to what will happen if the initial state of the relation is empty, I’m not sure. But it will be easy enough to test that to find out.

Worst case, you would just need a condition at the start of the action - one branch to deal with each initial state of the relation.

---

<div class="post-metadata">

**Author:** ![Simon\_Hill](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/simon_hill/32/94730_2.png) [@Simon\_Hill](https://community.glideapps.com/u/Simon_Hill)\
**Post date:** [March 5, 2024, 8:56am UTC](https://community.glideapps.com/t/deleting-multiple-rows-nesting/71418/3 "2024-03-05T08:56:38Z")

</div>

Thanks. Top tips.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [March 5, 2024, 12:50pm UTC](https://community.glideapps.com/t/deleting-multiple-rows-nesting/71418/4 "2024-03-05T12:50:43Z")

</div>

I have a similar scenario where I Set Column values in a couple of tables through relations. Those actions are among others that need to run regardless if the relations are empty or not. If those relations are empty, the entire button disappears.

> [@My Hard Stops and Annoyances](https://community.glideapps.com/t/my-hard-stops-and-annoyances/66846/1):
>
> I perform some actions through a Single Relation, such as a Set Column Action. This action is among other actions in a custom action that sets some values in the current row as well at rows in other tables before executing a Show Detail Screen action. I noticed that the button completely disappears if one of the single relations are empty. If there are no matches in the relations, then there is nothing that to needs to be set, but there is no reason why the rest of the action sequence can’t continue to run. I still need those other actions to occur but the button completely disappears. Short of breaking a single IF branch in the custom action into 3 or 4 separate branches to account for every possible scenario, I see no reason why the entire button needs to be disabled. This was not an issue in classic apps. I did the same thing and the button still worked as expected. This is only an issue introduced with New Apps.  
> Notice the highlighted actions. The relations for those actions may or may not be empty. If they are empty, who cares…the rest of the action sequence should work, so there is no reason to hide the button that calls this custom action. I’ll have to add 3 extra branches just to account for the times that one or both of the relations are empty and duplicate a lot of logic.  
> ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/4/74c4dad8e5a35bb87c72e499c9420a4cbb95f015.png)

---

<div class="post-metadata">

**Author:** ![Simon\_Hill](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/simon_hill/32/94730_2.png) [@Simon\_Hill](https://community.glideapps.com/u/Simon_Hill)\
**Post date:** [March 5, 2024, 1:20pm UTC](https://community.glideapps.com/t/deleting-multiple-rows-nesting/71418/5 "2024-03-05T13:20:56Z")

</div>

Agree. I think the logic should be to skip a step in the action when the relation is empty, not invalidate the whole action.

I have used Darren’s tip with the if else branch for the childless scenario and a wait for condition (relation becomes empty before deleting the parent) for the other, with a 3 second time out. I hope that works!

---

<div class="post-metadata">

**Author:** ![Joe\_Gabriele](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/joe_gabriele/32/57595_2.png) [@Joe\_Gabriele](https://community.glideapps.com/u/Joe_Gabriele)\
**Post date:** [March 5, 2024, 4:35pm UTC](https://community.glideapps.com/t/deleting-multiple-rows-nesting/71418/6 "2024-03-05T16:35:51Z")

</div>

Nice didnt know we could delete multiple rows now!

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [March 5, 2024, 4:45pm UTC](https://community.glideapps.com/t/deleting-multiple-rows-nesting/71418/7 "2024-03-05T16:45:31Z")

</div>

This has actually been possible for about a year and a half.

> [@new Deleting multiple rows from a delete action](https://community.glideapps.com/t/deleting-multiple-rows-from-a-delete-action/54734):
>
> It has finally arrived.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 5, 2024, 4:51pm UTC](https://community.glideapps.com/t/deleting-multiple-rows-nesting/71418/8 "2024-03-05T16:51:28Z")

</div>

> [@Joe\_Gabriele](#):
>
> Nice didnt know we could delete multiple rows now!

![](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/c/eca1ae32cc25a68fce4de0db370545dfee2d62fd.gif)

---

<div class="post-metadata">

**Author:** ![Joe\_Gabriele](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/joe_gabriele/32/57595_2.png) [@Joe\_Gabriele](https://community.glideapps.com/u/Joe_Gabriele)\
**Post date:** [March 5, 2024, 5:12pm UTC](https://community.glideapps.com/t/deleting-multiple-rows-nesting/71418/9 "2024-03-05T17:12:50Z")

</div>

Hahaha, never really had a use case. Dont know what you dont use! 🤣
