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

How to Remove multiple items from sharepoint list based off items items in a collection

I can't figure this out. 

 

I have a collection with a list of items the user has selected. I know how to take that list and patch it to an existing sharepoint, but how do I take the same list and remove those items from a different sharepoint list. 

 

The formula below only lets me remove 1 item. 

Remove(UnregisterProjectSignUpList,
First(Filter(UnregisterProjectSignUpList,Title=Unregister_EventName_Txtbx.Text && Signee.DisplayName = Var_OfficeName)));
 

I know it's not going to work because it's referencing the first text box in the gallery. I can't figure out how to say ForALL or all selected items and make it work. 

 

The sharepoint list to remove the items is called UnregisterProjectSignUpList and the collection with all the items needing to be removed is called User_UnregisterProjects_Selections

 

Anyone know how to make this work?

 

 
2 ACCEPTED SOLUTIONS

Accepted Solutions
mdevaney
Super User
Super User

@Becca51178

Does the User_UnregisterProjects_Selections collection have the ID number of the item you want to remove from UnregisterProjectSignUpList?

RemoveIf(UnregisterProjectSignUpList, ID in User_UnregisterProjects_Selections)

—-
Please Accept as Solution if this post answered your question so others may find it more quickly m. If you found this post helpful consider giving it a Thumbs Up.

View solution in original post

@EricLott 

Feel free to jump in if you see the solution first or the reason why ID might not be pulling in.

I thinking I'll have to see the code here.  I have not encountered any issues with ID before.

View solution in original post

8 REPLIES 8
EricLott
Resident Rockstar
Resident Rockstar

You can use RemoveIf(). The syntax would look like this:

 

RemoveIf(UnregisterProjectSignUpList,Title=Unregister_EventName_Txtbx.Text, Signee.DisplayName = Var_OfficeName)

---
If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up.

 

mdevaney
Super User
Super User

@Becca51178

Does the User_UnregisterProjects_Selections collection have the ID number of the item you want to remove from UnregisterProjectSignUpList?

RemoveIf(UnregisterProjectSignUpList, ID in User_UnregisterProjects_Selections)

—-
Please Accept as Solution if this post answered your question so others may find it more quickly m. If you found this post helpful consider giving it a Thumbs Up.

No and I don't understand why I can't get the ID to pull into the collection. Every time I try to put it in the collection it shows as blank

@Becca51178 

Can you show your code used to pull in the ID and also a screenshot of what the collection looks like in the viewer?  I would be curious to figure out why ID is not pulling in.

Ok give me 15 mins to get home

@EricLott 

Feel free to jump in if you see the solution first or the reason why ID might not be pulling in.

I thinking I'll have to see the code here.  I have not encountered any issues with ID before.

Ok it was my mistake. I had the ID pulling in the first collection, but not in the collection where I added columns

 

The RemoveIf worked awesome. Thank you so much!

@Becca51178 

I am glad to hear you've got it working again.  Best of luck building your app!

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (3,609)