cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
wilfordm81
Helper II
Helper II

Can one button delete a record from multiple tables?

Hi everyone,

 

I've been trying variations of this formula all morning, but haven't gotten where I needed to.

 

I have two SQL tables connected to two galleries, one gallery on one screen, and the other on a second screen.

 

When I click on the delete button currently, it deletes only the selected item from that gallery. Normal. And this it the formula:

Remove(SQLTable1, WatchScreenGall.Selected);

 

However, I've tried using if conditions, and RemoveIf, such as the following formulas, but nothing is coming of it. Which makes me wonder if two one records from two different tables can be deleted with on button?

 

Remove(SQLTable1, WatchScreenGall.Selected);
RemoveIf(SQLTable2, Subtitle2.Text = WatchScreenGall.Selected.Subtitle1)

 

Any thoughts?

 

Thanks in advance

 

W

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User
Super User

@wilfordm81 

I would try something like this, as it's possibly the case that WatchScreenGall.Selected.Subtitle1 isn't accessible following the removal of the parent record:

With({subtitle:WatchScreenGall.Selected.Subtitle1},
     Remove(SQLTable1, WatchScreenGall.Selected);
     RemoveIf(SQLTable2, Subtitle2 = subtitle)
)

 

I'd also check the filter condition of your call to RemoveIf, to make sure it refers to a column name. I assume the column name you want to match is Subtitle2, rather than Subtitle2.Text?

 

View solution in original post

2 REPLIES 2
timl
Super User
Super User

@wilfordm81 

I would try something like this, as it's possibly the case that WatchScreenGall.Selected.Subtitle1 isn't accessible following the removal of the parent record:

With({subtitle:WatchScreenGall.Selected.Subtitle1},
     Remove(SQLTable1, WatchScreenGall.Selected);
     RemoveIf(SQLTable2, Subtitle2 = subtitle)
)

 

I'd also check the filter condition of your call to RemoveIf, to make sure it refers to a column name. I assume the column name you want to match is Subtitle2, rather than Subtitle2.Text?

 

Hi @timl!

 

Thanks for responding!

 

So the column name was actually also Subtitle1. However previously, I was targeting the .Text element, as if it were some ID of sorts 🙄.

 

Anyway, that formula has worked a treat!

 

Thanks so much!

 

W

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (1,345)