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 / Patching several regis...
Power Apps
Answered

Patching several registers starting from a Gallery

(0) ShareShare
ReportReport
Posted on by 21

All right. We are trying to patch several registers to update the inventory with a single button. So far, no good.

 

Have tried something like this:

 

ForAll(
Gallery1_5.AllItems;
Patch(
'SP_List';
LookUp('SP_List'; Gallery1_5.Selected.Título = Título);
{
Quantidade:Value(Gallery1_5.Selected.Quantidade) - TextInput2.Text
}
)
)

/*Patch('SP_List';
ForAll(
Gallery1_5.AllItems;
{
Quantidade:Value(Gallery1_5.Selected.Quantidade) - TextInput2.Text
}
)
)*/

 

Is ForAll the best approach? Quantidade is the quantity. Don't mind the semicolon, different language.

 

captura 1.png

captura 2.png

 

Thank you very much

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,545 Most Valuable Professional on at

    Hi @Rushtrinity .

    ForAll() is the correct approach, but you need to refer to each item in the gallery

    Patch(
     'SP_List';
     ForAll(
     Gallery1_5.AllItems As _Data;
     With(
     {
     _ID:
     LookUp(
     'SP_List'; 
     Título = _Data.Título
     ).ID
     };
     {
     ID: _ID;
     Quantidade:Value(_Data.Quantidade) - Value(_Data.TextInput2.Text)
     }
     )
     )
    )

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Rushtrinity Profile Picture
    21 on at

    Man, it seems it worked, but I can't say I understand the rationality behind the solution.😂 Would you mind to explain to me how does it work specially regarding the As _Data, the _ID and the ).ID?

     

    Also, what 

    ID: _ID;
    Quantidade:Value(_Data.Quantidade) - Value(_Data.TextInput2.Text)

     

    is comparing?

     

    Edit: Oh, I think I got the logic. 

     

     

    TYVM

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

    @Rushtrinity ,

    The As function is a disambiguation operator and useful to identify the source and target of ForAll patches separately. He second bit is finding the ID of the target record in the With() statement and then using it to specify the record to Patch.

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

#2
Mohsin Ali Profile Picture

Mohsin Ali 368

#3
WarrenBelz Profile Picture

WarrenBelz 244 Most Valuable Professional

Last 30 days Overall leaderboard