web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Remove from collection...
Power Apps
Answered

Remove from collection based on criteria

(0) ShareShare
ReportReport
Posted on by

Hi,

I have two collections
ColBooked

LaptopBookedOnTimeSlotLaptopID
Laptop A10 Sep 202212:00-13:00LP101A
Laptop A10 Sep 202215:00-14:00LP101A
Laptop B10 Sep 202212:00-13:00LP102B

 

ColToCancel

LaptopBookedOnTimeSlotLaptopID
Laptop A10 Sep 202212:00-13:00LP101A
Laptop B10 Sep 202212:00-13:00LP102B

 

How do I remove the items from ColToBook that exist in ColToCancel?

Categories:
I have the same question (0)
  • EricBLott Profile Picture
    248 on at

    Here is the documentation for the RemoveIf() function.

    https://docs.microsoft.com/en-us/power-platform/power-fx/reference/function-remove-removeif

     

    You can use that function like this:

    RemoveIf(ColToBook,LaptopID in ColToCancel.LaptopID)

  • I_Mo Profile Picture
    on at

    Thanks @EricBLott . I have tried this method already, but as you can see I do not want to remove all that match the LaptopID. I want to remove only those that match the date and time for each LaptopID in ColToCancel.

  • Verified answer
    EricBLott Profile Picture
    248 on at

    Ideally, you could add a unique ID for each slot. However, if that's not possible, you can do this:

    ClearCollect(colBookedUnique,AddColumns(colBooked,"laptopSlotId",Concatenate(LaptopID,BookedOn,TimeSlot)));
    With(
     {
     colToCancelUnique: AddColumns(colToCancel,"laptopSlotId",Concatenate(LaptopID,BookedOn,TimeSlot))
     },
     RemoveIf(
     colBookedUnique, laptopSlotId in colToCancelUnique.laptopSlotId)
    );
    ClearCollect(colBooked,DropColumns(colBookedUnique,"laptopSlotId"));

    This creates a unique column by concatenating the timeslot, date, and laptop ID columns together, filters that temporary collection, then ClearCollect()s it into the colBooked collection.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard