Skip to main content
Community site session details

Community site session details

Session Id : DThSh1ykcCgnVjYeCQJOhK
Power Apps - Building Power Apps
Answered

How might I list orphaned records

Like (0) ShareShare
ReportReport
Posted on 18 Jan 2021 18:52:49 by 523

I have two custom CDS tables, "Contact," and "Agency"

Contact has a N:1 relationship to Agency, being a lookup column in the Agency table.

Presently it's possible to delete Agencies without also deleting the associated Contacts.

Is there a way to filter a gallery of these contacts, based on their *absence* from any associated agency? i.e. I would like to exclude any contact that already has a presence in an agency lookup record.

To make it even more complicated, I would need to create a filter not subject to the delegation limit, because there are presently 35,000 agencies in the database.

Any guidance would be greatly appreciated,

Thanks!

  • Medoomi Profile Picture
    523 on 18 Jan 2021 at 22:02:34
    Re: How might I list orphaned records

    Thank you so much @Drrickryp . That was definitely an easy solution!

  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on 18 Jan 2021 at 21:14:10
    Re: How might I list orphaned records

    Hi @Medoomi 

    You could go to the Data > Table > View menu and create a filtered view of your data where the foreign key does not contain data. Then in PowerApps you can use that view to populate a Gallery that will show you all the orphaned records. _2.png_1.png

     

     

     

     

     

     

     

     

     

     

     

     

    If you are using the built in relationships in CDS, you can prevent this from happening by checking the box in the Advanced section under relationships.  See how to do this here: https://docs.microsoft.com/en-us/powerapps/maker/data-platform/data-platform-entity-lookup  and go to the bottom of the page.  If you are using the manual method for defining the relationships (Like you and I discussed previously), you can find them by creating a View like I described above.

  • yashag2255 Profile Picture
    24,669 Super User 2024 Season 1 on 18 Jan 2021 at 19:25:42
    Re: How might I list orphaned records

    @Medoomi  

     

    Can you try to use the below expression:

    Filter(Contacts,CountRows(Filter([@'DataSources'],Contact in ColumnNameinDataSource.Contact))=0)

     

    This shows a delegation warning, as there is no way to achieve this without the delegation warning.

     


    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473