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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (4,658)