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 / Bulk update a set of r...
Power Apps
Answered

Bulk update a set of records

(0) ShareShare
ReportReport
Posted on by 2,297

Hello,

 

I'm trying to bulk update a set of records in datasource "Investments" - a SharePoint list with the value the user enters into TextInput2:

 

Patch(Investments, LookUp(Investments, Cod_Projeto_Key = CodigoProjeto), {Cod_Projeto_Key: TextInput2.Text});

 

But this is only updating the First record of the list.

 

Why? The Lookup returns a set of records or only the first it finds?

 

I'm trying to understand the article How to bulk update records in PowerApps 

 

But since I'm not using collections here, it gets a bit too confusing...

Categories:
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @WebPortal 

    LookUp returns a record...not a table.

     

    What you are looking for is this:

    UpdateIf(Investments, Cod_Projeto_Key = CodigoProjeto, {Cod_Projeto_Key: TextInput2.Text})

     

    I hope this is helpful for you.

  • WebPortal Profile Picture
    2,297 on at

    @RandyHayes 

    Thanks, but Filter does return a table, right?

    So, this one should work:

    Patch(Investments, Filter(Investments,Cod_Projeto_Key = CodigoProjeto), {Cod_Projeto_Key: TextInput2.Text});

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @WebPortal 

    Yes, filter returns a Table, but then your Patch will not work because you are trying to patch a table to the datasource, which is fine, but then trying to also patch a record into that, which will mismatch.

    You could do this:

    Patch(Investments,
     ForAll(
     Filter(Investments, Cod_Projeto_Key = CodigoProjeto),
     Patch(ThisRecord, {Cod_Projeto_Key: TextInput2.Text})
     )
    )

    But why??  When you can just do this:

    UpdateIf(Investments, Cod_Projeto_Key = CodigoProjeto, {Cod_Projeto_Key: TextInput2.Text})

     

  • WebPortal Profile Picture
    2,297 on at

    @RandyHayes  thanks, that makes more sense.

    But, after trying that expression, I get empty cells for column Cod_Projeto_Key where the values should be changed to TextInput2.Text

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @WebPortal 

    Which formula are you referring to that gives you empty cells - the long one with patch or the UpdateIf?

     

    What kind of column is Cod_Projeto_Key in your list?

  • WebPortal Profile Picture
    2,297 on at

    Sorry, the UpdateIf

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @WebPortal 

    What kind of column is Cod_Projeto_Key in your list?

  • WebPortal Profile Picture
    2,297 on at

    It is a single line of text.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @WebPortal 

    How many records are in your list?

  • WebPortal Profile Picture
    2,297 on at

    300.

    I want to update 5 for a test I'm making.

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

#2
M Bilal Khan Profile Picture

M Bilal Khan 320

#3
Mohsin Ali Profile Picture

Mohsin Ali 246

Last 30 days Overall leaderboard