In my canvas app, I have three tables. For simplicity call them actor (Primary text column:ActorName) , movieactor (Primary column: ID) , and movie (Primary text column; MovieName). I have a table showing info about the movie, and the actors having played in them.
I have a delete button, so the user can delete the movie they no longer are interested in. So far so good (
, the problem starts when I first want to delete all related rows in the movieactor table that contains this movie. How can this be achieved by Power Apps formula?
Thank you very much, this fixed my problem😀
hi @Jan_Henrik ,
To achieve this in PowerApps, you'll need to delete the related rows in the movieactor table before deleting the selected movie from the movie table. You can use the ForAll function along with the Remove function to iterate through the related rows in the movieactor table and delete them. Here's how you can do it:
// Step 1: Identify related rows in the movieactor table
ClearCollect(
relatedMovieActors,
Filter(movieactor, MovieID = tbl_Movie.Selected.ID)
);
// Step 2: Delete related rows from the movieactor table
ForAll(
relatedMovieActors,
Remove(movieactor, ThisRecord)
);
// Step 3: Delete the selected movie from the movie table
Remove(movie, tbl_Movie.Selected);
WarrenBelz
146,522
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,890
Most Valuable Professional