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 / Filtering a one to man...
Power Apps
Unanswered

Filtering a one to many relationship collection

(0) ShareShare
ReportReport
Posted on by 353

I have two tables PMMS_Sites and PMMS_Site_Items. 1-N
(One site has many Items)

On page 1 I have a gallery Items = PMMS_Sites
On clicking an item in the galltery it takes you to page 2;
The second page should show a filtered list based on the selection of 'homeGallery'.

I cant quite work out how to filter the clearcollect for the second gallery. 

This is what I have but incorrect

 

ClearCollect(col_PMMS_Site_Items, Filter(PMMS_Site_Items,PMMS_Sites=homeGallery.Selected.ID))

 

nick9one1_0-1654947997143.png

 

Can anyone help?


Categories:
  • MVP-Phipps Profile Picture
    3,526 Super User 2024 Season 1 on at

    So you have sites in one table and each site will have many site items. You want a gallery to display sites and then when you select a site for it to then go to a second page where the gallery shows the site items?

     

    If so use Lookup() not Filter()

  • nick9one1 Profile Picture
    353 on at

    thanks! I thought filter was for returning a set or results and lookup only returned one. 

    I've changed to Lookup. I think I'm nearly there, but not quite

    nick9one1_1-1654954695321.png

     

     

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @nick9one1 

    Items property of gallery2:

    homeGallery.Selected.PMMS_Site_Items

  • nick9one1 Profile Picture
    353 on at

    I think its working. I found this does it with less code;

    ClearCollect(col_PMMS_Site_Items, homeGallery.Selected.PMMS_Site_Items);

     

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @nick9one1 

    I'm not sure if there is any advantage to using a collection here. 

  • nick9one1 Profile Picture
    353 on at

    thanks, thats interesting to know. 

    So now I have my second issue.. 

    My relationship is three layers

    one site to many Items.
    one Item to many submissions. 

    Sites < Items< Submissions

    How would I get the submissions for the selected gallery site?

    I would imagine something like this, but powerapps doesnt like the syntax 

     

     

    homeGallery.Selected.PMMS_Site_Items.PMMS_Submissions

     

    or maybe this

    ClearCollect(col_PMMS_Site_Items, homeGallery.Selected.PMMS_Site_Items);
    
    ClearCollect(col_PMMS_Site_Submissions, col_PMMS_Site_Items.PMMS_Submissions);
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @nick9one1 

    Check out this blog post about "walking" the dots. https://powerapps.microsoft.com/en-us/blog/one-to-many-relationships-for-canvas-apps/ .  

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 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard