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 / Need help speeding up ...
Power Apps
Unanswered

Need help speeding up forAll patch

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi, I've got a patch function that updates a single field in some items in the CDS.

Currently, its I'm told it's too slow with about 16 items being patched.

 

This is the code:

 

ForAll(
 Categories_Gallery.AllItems,
 ForAll(Items_Gallery.AllItems,
 Patch(
 [@Items],
 LookUp([@Items], Name = ItemNameLbl.Text),
 {
 Inspection_result: InspectionResultRadio.Selected.Value
 } 
 );
 )
);

 

 

The items are inside a gallery, which is inside of a gallery of categories.

It gets every item from its gallery and then patches it. Right now, it takes about 5 seconds to do this and then navigate away from the screen.

 

Is there any way to make this faster? I was looking at concurrent() to split up the patch but the gallery has a variable amount of categories and items in it, so I don't think that would work.

Categories:
  • mdevaney Profile Picture
    29,993 Moderator on at

    @Anonymous 

    What is the name of your Primary Key in the CDS table?  Is it found in your gallery?  If yes, tell me the column name and  I can show you how to patch multiple records at once using the 'FAST PATCH' method.  Below is a preview of how I do it.  Please let me know the answer to my questions and I'll help you out.

     

    Syntax:

    Patch(your_datasource_name, your_collection)


    Link To Article:

    https://matthewdevaney.com/patch-multiple-records-in-power-apps-10x-faster/

     

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    The primary key for the Categories is item_categoryid and for the items is itemid.

    These are not currently used in the galleries, but both primary name fields are.

  • mdevaney Profile Picture
    29,993 Moderator on at

    @Anonymous 
    You'll need to include the primary key in your gallery.  It doesn't need to be shown as a label.  It just needs to be included in the record.  Once you have done this let me know.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Sorry for the late reply, I wasn't able to work on the powerapp until now.

     

    I have included both primary keys in the galleries, I've just added them as labels and hidden them.

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

#2
Mohsin Ali Profile Picture

Mohsin Ali 323

#3
WarrenBelz Profile Picture

WarrenBelz 193 Most Valuable Professional

Last 30 days Overall leaderboard