Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 9hR+eOrdap8Ib30kvPIGHx
Power Apps - Building Power Apps
Answered

Clearcollect All gallery Items with users updated inputs / Patch updated users input from Gallery Items to Collection

Like (0) ShareShare
ReportReport
Posted on 25 May 2023 01:48:28 by 16

Is there a way where we can create a collection from PowerApps Gallery which can capture all the items from gallery along with the Input Dropdown values passed by users.

I have tried two methods -

a) Clearcollect required columns from Gallery but it doesn't store the Input values made by user from Drop down field, instead it shows the DataSource values itself which isn't required.

b) Patch the required columns from Gallery to a collection with "For All" and Patch function with This record/This Item property. It's working but running very slow. 

 

I am working on large dataset which goes beyond 2000 records where I am using collections to move data from source to Gallery then Gallery to a new collection with specific columns which are fed by Users and then Patch just those columns through Patch(Datasource,Collection with limited columns) to optimize the Ingestion of data and submission of records by users.

 @WarrenBelz , @BCBuizer , @v-bofeng-msft @v-qiaqi-msft , @RezaDorrani 

  • Verified answer
    BCBuizer Profile Picture
    22,070 Super User 2025 Season 1 on 25 May 2023 at 13:24:59
    Re: Clearcollect All gallery Items with users updated inputs / Patch updated users input from Gallery Items to Collection

    Hi @Yogesh2 ,

     

    As far as I know what you described is the fastest method since UpdateIf is not delegable, so can't be applied to the datasource directly if it has more than 2000 items.

  • Yogesh2 Profile Picture
    16 on 25 May 2023 at 11:31:40
    Re: Clearcollect All gallery Items with users updated inputs / Patch updated users input from Gallery Items to Collection

    Hi @BCBuizer , 
    I did try to use this formula 

    ClearCollect(Collection, Gallery1.AllItems)

     but there was an error stating that the data source provided is invalid. 
    Also, as you mentioned Gallery would only show 100 records from data source at once until it's scrolled down further to load more records. For this I have loaded the data from Data source to a collection and to check if all the records are loaded or not, I have used count function as well which does show the total records in the collection. The only challenge I am facing is to collect the updated information by users from the Gallery to the new collection or update the existing collection with the updated information.


    Alternatively, after posting the question I had used Updateif function to update the records in the collection and then patch Collection to datasource using Patch(Datsource,collection) from gallery. It's better than ForAll + Patch function but I am wondering if there's some other better method to optimize this which could take less time comparatively.

  • BCBuizer Profile Picture
    22,070 Super User 2025 Season 1 on 25 May 2023 at 09:16:23
    Re: Clearcollect All gallery Items with users updated inputs / Patch updated users input from Gallery Items to Collection

    Hi @Yogesh2 ,

     

    In theory you can simply use the below formula:

    ClearCollect(Collection, Gallery1.AllItems)

     

    In practice there are some restrictions though:

     

    If Gallery1 is connected to a datasource, it will only load 100 items unless the user scrolls all the way to the bottom of the gallery when another 100 items are loaded. The is will continue until all items in the datasource are loaded. Whenever the formula is executed, only the items that are loaded will end up in the collection.

     

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 89 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 58

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 42 Super User 2025 Season 1

Overall leaderboard
Loading started