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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Create a collection wi...
Power Apps
Unanswered

Create a collection with the items that are present in one table, but not in another, i.e. creating a "Diff" between tables

(0) ShareShare
ReportReport
Posted on by 2

Here is my challenge:

- I query from AD a list of the people in my company, and put it in a collection: colPeople

- I save that list in a CDS table, named tblPeople, so that I can add more details for each of the persons

 

This gives me a snapshot of who is in the company at the time of the query.

 

If I want an updated list from AD, I can query again and populate colPeople, but it will give me a different list of items, because some people will have joined, some people will have left.

 

I want to update my CDS-based table with the latest updates from AD, what it the best way to proceed if I need to:

  1. remove from tblPeople the people that are not in colPeople anymore
  2. add to tblPeople the people that have appeared in colPeople since the last query
  3. modify information in tblPeople to match the latest colPeople information

 

I am trying to create a new collection that would match the first need, and the best I can do is a button with:

ForAll(colPeople,If(IsBlank(LookUp(tblPeople,ThisRecord.'Full Name' = ThisRecord.'Full Name')),Collect(colinADnotCDS,ThisRecord))).

 

However, "ThisRecord" seems to always refer to tblPeople items, not colPeople items.

 

Thanks for any pointer or help!!

Categories:
  • WarrenBelz Profile Picture
    156,570 Most Valuable Professional on at

    Hi @MoonLunatic ,
    Ambiguity is the issue here - try

    ForAll(
     colPeople as aPeople,
     If(
     IsBlank(
     LookUp(
     tblPeople,
     'Full Name' = aPeople.'Full Name'
     ).'Full Name'
     ),
     Collect(
     colinADnotCDS,
     ThisRecord
     )
     )
    )

    or maybe this

    ClearCollect(
     colinADnotCDS,
     Filter(
     tblPeople,
     !('FullName in colPeople.'Full Name')
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • WarrenBelz Profile Picture
    156,570 Most Valuable Professional on at

    Hi @MoonLunatic ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • MoonLunatic Profile Picture
    2 on at

    Hi Warren, sorry, I am not working on this project full time and have not been able to check whether your suggestion works out for me! Once I have tried it out, I will confirm it works or ask for more advice 🙂

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard