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 / Collect all records ba...
Power Apps
Answered

Collect all records based on one value on start

(1) ShareShare
ReportReport
Posted on by 588

I'm sure this is really simple but I just can't work it out. It's been one of those weeks!

 

My data source has people listed and put into groups (1, 2, 3 etc.)

 

I need my app to create a collection of the records in the same group as the user eg. Mrs Piggy is in group 99, when she logs in, the app should pull all the records associated with group 99 into one collection

 

I've managed a lookup to get the app user's details pulled into a collection, but I'm struggling with pulling in all the other associated group's records.

 

Example of my data source:

Screenshot 2022-11-02 114904.png

 

Categories:
I have the same question (0)
  • Fredrik_A Profile Picture
    3,644 Super User 2026 Season 1 on at

    Its probably easier to just filter the datasource instead of making a new collection.

     

     

  • misc Profile Picture
    588 on at

    Okay then. The reason I was thinking of a new collection was because I then need to do some work with the data returned. Essentially, the users will be peer reviewing their other group members, so I wanted to have the group members referred to in, for example, the DataCard title of the Form they're completing. 

     

    Screenshot 2022-11-02 120526.png

    Where in my example PR1 would be 'Rate Napoleon', PR2 'Rate Miss Piggy, and PR3 'Rate Steve Irwin'.

     

    Can I just do this with a filter? I'd then need to write back to other columns (PR1Name/PR2Name etc. not shown) the names of who was rated under each section. I thought that would be easiest with a collection to refer back to. Does that make sense?

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @misc I would agree with @StretchFredrik . I would advise you to beware of the following.

     

    Suppose you have a data row limit of 500 in your app (this is the default. It can be raised to a max of 2000 - the default is 500).

     

    (for reference, the Data Row Limit is under Settings -> General (scroll down) -> Data row limit)

    poweractivate_0-1664872234598.png

     

     

    Suppose you have a delegable Filter which returns more than 500 Records, say it is supposed to returns 725 Records. If you put this in the Items property of your Gallery, you should notice that when scrolling through the Gallery, it should show the 501st Record and beyond. However, if you use a single call to the Collect, ClearCollect, or Set, or UpdateContext function, you should notice that the number of Records in your collection would be 500 i.e. no greater than the data row limit of the app.

     

    There should be no yellow triangle delegation warning because there is no delegation issue here, the issue is that those functions are subject to the data row limit, and there's no warning for using functions in a way that would cause there to be less records returned than expected due to there being more records present in the expected stuff to be returned than the current data row limit.

     

    Just in case it helps, this is why I'd agree with @StretchFredrik - where possible, just use the Filter directly (especially when already using a Gallery, just use the Filter directly in the Items property of the Gallery where possible), without using any intermediate Collections (i.e. ClearCollect, Collect), context variables (UpdateContext), or variables (Set) - wherever it is possible for you to do so.

     

    Let's suppose the example of using the Items property of a Gallery. To do more things with the returned data, just keep adding more functions to that same formula. For example, if you already have a delegable Filter in the Items property of a Gallery right now, just go ahead and surround that already working Filter function with another function (ideally, another delegable function) to do additional stuff with what you already have.

  • misc Profile Picture
    588 on at

    My data source will never be more than ~50 records, so delegable or not isn't a huge worry for this project. I also wasn't planning to use a gallery at all, but rather directly into the Form. I think that's why I'm struggling with understanding how to use a Filter to do what I want.

  • Verified answer
    poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @misc 

    Then try something like the below. Adjust the below as needed.

     

    //adjust as needed
    //In the below, SomeList should be changed to the name of your List,
    //and it should be the same List for both the inner LookUp and the outer Filter.
    
    ClearCollect(myCollectionGrp,Filter(SomeList,Group=LookUp(SomeList,Email=User().Email).Group)
    
    //change anything else above as appropriate if needed.

     

     See if it helps @misc 

  • misc Profile Picture
    588 on at

    That's done it, thank you!

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 316 Most Valuable Professional

#2
11manish Profile Picture

11manish 242

#3
Valantis Profile Picture

Valantis 198

Last 30 days Overall leaderboard