cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ritoxik
Frequent Visitor

Using 'Remove' for a table (not a Collection) and from a ForAll Loop of another table

I want to 'delete' records in table2 

if they are found in table1

PowerApps complains that Table2 is not a Collection

 

Here is the code;

 

ForAll(Table1,
Remove(Table2,First(Filter(Table2,Table2_ID=Table1_ID)))
);

 

 

4 REPLIES 4
KyleJ
Helper II
Helper II

Why not make it a collection? 

RandyHayes
Super User III
Super User III

@Ritoxik 

Please consider changing your Formula to the following:

ForAll(Table1,
   RemoveIf(Table2, Table2_ID=Table1_ID)
);

This should give you what you want.

 

I hope this is helpful for you. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

I did try that too, but still complaining that it should be a Collection

* What I finally did is to change the Table2 into a Collection, and kept only Table1 as a Table

 Thus Remote & RemoteIf seems to work only on Collection, but in the PowerApps Documentation it says "data source" Tables & Collections...

 

Now I will try again on an empty test App to see if your statement works, just to make sure it is nothing wrong on my App that give that error message with Collection required

 

RandyHayes
Super User III
Super User III

@Ritoxik 

A collection is not required.  This can be a datasource and we use this formula ALL the time without issue.

Make sure you don't have some other item in your App that is called Table2 - check your Variables and Collections to make sure you are actually dealing with the datasource and not something else.

 

EDIT: Oh and I do assume you are using pseudo names in your examples as there are other factors involved if you are trying to use that exact formula.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (45,464)