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 / Problems with executin...
Power Apps
Answered

Problems with executing the forall and patch function at the same time

(0) ShareShare
ReportReport
Posted on by 19

Hi,

 

If some can help, Ive been having this problem while executing the forAll and path function at the same time. The problem that shows is "Patch function can not be executed at the same data source of the ForAll does"

 

 

ForAll('Master de Pedios Unimarket';Patch('Master de Pedios Unimarket';LookUp('Master de Pedios Unimarket';Soportegalleria.Selected.NumOrden=NumOrden);{Estado:Dropdown3.Selected}))

 

Any help?

 

Categories:
I have the same question (0)
  • Sutherland Profile Picture
    Microsoft Employee on at

    Hello Aaronramosr,

    You could have a try on below formula type which would solve your mentioned same data source issue.  

    ForAll(Datasource,
    Patch(Datasource, {ID: Datasource.ID}, {Column_A: Left(ReminderDates, 10), Column_B: Mid(ReminderDates, 12, 10), Column_C: Right(ReminderDates, 10)})
    )
    ForAll(CheckedItems,Patch(ChecklistItemsSource,LookUp(ChecklistItemsSource, Id = CheckedItems[@Id]),{Status:"Done"}))

    Check following blog on bulk update records in PowerApps & ForAll and Patch for more details
    https://powerapps.microsoft.com/ru-ru/blog/bulk-update-using-forall-and-patch/
    https://powerusers.microsoft.com/t5/Building-Power-Apps/ForAll-and-Patch-Split-a-Column-into-three-and-patch-the/td-p/47748

  • Verified answer
    v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @aaronramosr ,

     

    Yes, it isn't allowed to handle the same Data source on ForAll() function and internal Patch() function at the same time, since the Patch function will modify the Data source in each loop, resulting in a conflict between two function.

    You can save the data source to collection using ClearCollect() function, and then take the collection as the Table of ForAll() function.

     

    However, from your code, I think there is no need to use ForAll/Patch combination if you don't need to reference value from table of ForAll function. The UpdateIf function can fully achieve your need, please try this:

    UpdateIf('Master de Pedios Unimarket'; NumOrden=Soportegalleria.Selected.NumOrden;{Estado:Dropdown3.Selected})

    Hope this helps.

    Sik

     

  • aaronramosr Profile Picture
    19 on at

    Thank you so much, it worked perfectly

  • Pxtavern Profile Picture
    79 on at

    Thank you your code 

    UpdateIf('Master de Pedios Unimarket'; NumOrden=Soportegalleria.Selected.NumOrden;{Estado:Dropdown3.Selected})

    Did exactly what I needed 

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
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard