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 / Dynamic table inside f...
Power Apps
Answered

Dynamic table inside forall loop

(1) ShareShare
ReportReport
Posted on by 37

Morning All,

 

Matthew Devaney has a post that talks about exceeding the 2000 row limit for collections. It's a great post and almost exactly what I need. Is there a way to make the table in the below code dynamic:

 

Clear(colCars);
ForAll(
 ["Ford", "Dodge", "Toyota"],
 Collect(colCars, Filter('Car Inventory', CarMake=Value))
);

 

Instead of Ford, Dodge and Toyota, I have six names. I could obviously hard type the six names but I was hoping there's a way to all ow me to create the list of names dynamically. My thoughts were to collect a distinct list of names from the sharepoint list and then dynamically create a table from those names. Is that even possible? Any help appreciated.

 

Cheers,

Mark

 

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

    Hi @MNixey ,

    If you had a multi-select combo box and (for instance) the Items were

    CarModel.Make

    then your code would be

    Clear(colCars);
    ForAll(
     ComboBoxName.SelectedItems, 
     Collect(
     colCars, 
     Filter(
     'Car Inventory', 
     CarMake = Make
     )
     )
    )

     

    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

  • Waegemma Profile Picture
    583 Super User 2024 Season 1 on at

    Hi @MNixey ;

     

    @WarrenBelz is right.

     

    I only want to add, since you asked about populating the list of carmakes: you can't get the different carmakes via Distinct because Distinct can't be delegated.

     

    An option is to make carmake a choices column in your list and setting the items of the above multi-select combo to Choices(YourList.YourCarMakeColumn).

     

    Marc

  • MNixey Profile Picture
    37 on at

    Thanks @WarrenBelz and @Waegemma . I am wanting to run this on start. I have a sharepoint list with about 600 records per person. The number of records per person will be pretty consistent but people will come on and drop off the list. Do you reckon that's doable? 

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

    Hi @MNixey ,

    When you say 600 per person, are you wanting a list of distinct values based on a lookup to their email or name ?

  • MNixey Profile Picture
    37 on at

    Thanks very much for the quick replies Warren. Each person (based on name) has about 600 records against their name. The column containing the names is called field_18...

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

    Hi @MNixey ,

    I am guessing a bit here, as your initial post was an example. Do you have a list of people you want to apply this to ?

    If so

    ForAll(
     PeopleSPList As aCol,
     Collect(
     colMyCol,
     Filter(
     MySPList,
     Field_18 = aCol.ListPersonField
     )
     )
    )
     

     

    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

  • MNixey Profile Picture
    37 on at

    Thanks so much. I'm still struggling a little but I feel like it's my lack of understanding (and I'd like to work through it for a while). I'll have a crack with this, see if I can get it to work and let you know

  • MNixey Profile Picture
    37 on at

    Sorry Warren,

    My ignorance has got the better of me. I've never seen the "as aCol" syntax before but I've commented what I think is going on. 

    And just in case I haven't explained myself very well. I have a sp list (called Karbon) with about 5000 records in it. I'm trying to get this into a single collection on start by creating a collection that uses a for all loop to loop through each person's records from the Karbon list. I can get this to work with static names but it would be ideal to make it dynamic as names change. Thanks again.

    // this collects the distinct values from the SharePoint list's people field (this people field is type text)
    Collect(PeopleSPList, Distinct(Karbon, field_18));
    // colMyCol is the collection that I want to use as my output containing all the records matching the names
    // in the PeopleSPList collections
    Clear(colMyCol);
    ForAll(
    // i'm not what this next line means
     PeopleSPList As aCol,
     Collect(
     colMyCol,
     Filter(
     Karbon,
     // .Result is the only option provided in the automcomplete - it gives no error but colMyCol is empty
     field_18 = aCol.Result
     

     

  • Verified answer
    WarrenBelz Profile Picture
    156,526 Most Valuable Professional on at

    Hi @MNixey ,

    That is why I asked you if you had a list with the names you wanted to include - you have to get the data from somewhere. If you are saying the names are only in the list with the 5,000 items, then you cannot get the Distinct Values you are after as Distinct() is not Delegable. Please confirm where the relevant names are located. The only other possibility is if all the names are present in the newest 2,000 records, but I will not go there until you confirm.

  • MNixey Profile Picture
    37 on at

    Thanks @WarrenBelz - the delegable information didn't hit home with me until the second time - I have utilised another list and now I'm all good. Thanks for persevering 😊 

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard