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 / How might I list orpha...
Power Apps
Unanswered

How might I list orphaned records

(0) ShareShare
ReportReport
Posted on 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!

Categories:
I have the same question (0)
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    @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!

  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    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.

  • Medoomi Profile Picture
    523 on at

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

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 793 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 333 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard