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 / Using Patch and LookUp...
Power Apps
Answered

Using Patch and LookUp to udpate a Sharepoint list

(1) ShareShare
ReportReport
Posted on by 94
I have a Gallery 01, and filter this Gallery 01 I collect in another Gallery 02 some record from the Sharepoint list “SpeseV01”.
In this way I create with the selected record in the Galley a collection “MyCollection”.
I modify the value of some records in the collection, and after I want update the record in the sharepoint list.
To make this, I have two buttons ( I’m not able use only one button, and I don’t’know why).
The first button  in the “OnSelect property” has:
 “ClearCollect(MyCollection; Gallery3.AllItems)”
So in this way I have all the elements modified in the collection.
The second button in the OnSelect property has :
“ForAll(

   MyCollection;
   Patch(
       SpeseV01;
       LookUp(SpeseV01; ID = ThisRecord.ID);
       {  Title: txtTitolo.Value;
           TipoSpesa: dropTipoSpesa.Selected;
           Importo: numImporto.Value;
           DataSpesa: dateDataSpesa.SelectedDate;
           Pagamento: dropPagamento.Selected;
           Fornitore: txtFornitore.Value;
           Note: txtNote.Value;
           DataRimborso: dateDataRimborso.SelectedDate;
           IDRimborso: txtIDRimborso.Value
           })
              )

But it doesn’t’ work.
If I use the monitor, the error is :
“Fetching Items failed. Possible invalid string in filter query.”
What can I do ? I’m new of patch and LookUp function.
Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    154,496 Most Valuable Professional on at
    The fundamental issue here is that you cannot Patch from the Collection while referring to the control values in the Gallery - either do one or the other - Patch from the Gallery and refer to the control content
    Patch(
       SpeseV01;
       ForAll(
          Gallery01.AllItems As _Data;
          {  
             ID: _Data.ID
             Title: _Data.txtTitolo.Value;
             TipoSpesa: _Data.dropTipoSpesa.Selected;
             Importo: _Data.numImporto.Value;
             DataSpesa: _Data.dateDataSpesa.SelectedDate;
             Pagamento: _Data.dropPagamento.Selected;
             Fornitore: _Data.txtFornitore.Value;
             Note: _Data.txtNote.Value;
             DataRimborso: _Data.dateDataRimborso.SelectedDate;
             IDRimborso: _Data.txtIDRimborso.Value
          }
       )
    )
    or Patch from the Collection and refer to the field names in it (I have assumed the names here)
    Patch(
       SpeseV01;
       ForAll(
          MyCollection As _Data;
          {  
             ID: _Data.ID
             Title: _Data.Title;
             TipoSpesa: _Data.TipoSpesa;
             Importo: _Data.Importo;
             DataSpesa: _Data.DataSpesa;
             Pagamento: _Data.Pagamento;
             Fornitore: _Data.Fornitore;
             Note: _Data.Note;
             DataRimborso: _Data.DataRimborso;
             IDRimborso: _Data.IDRimborso
          }
       )
    )

    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee

     
  • ancorte Profile Picture
    94 on at
    Thank you Warren !!!
    It's all ok and it works perfectly ! I think that i have to understand better  how to use the patch function. Any suggestion will be appreciated !
  • WarrenBelz Profile Picture
    154,496 Most Valuable Professional on at
    What part are you having trouble understanding ?
  • ancorte Profile Picture
    94 on at
    The actual problem is the Patch..For All (i'm not sure to have understood exactly how it works).
     
    In the Gallery i have only the record that i filtered with another Gallery (and it's ok.)
    For example, if i have 3 records, an modify the value in the field "Import",  when i push the button it modify with the new value of "Importo" all the 3 records.
     
    The "Onselect" property of the button, applying your suggestion, is this (but i can made an error...)
    Patch(SpeseV01;
     ForAll(Gallery3.AllItems As _Data;
     
           {ID: _Data.ID;  
            Title: txtTitolo.Value;
               TipoSpesa: dropTipoSpesa.Selected;
               Importo: numImporto.Value;
               DataSpesa: dateDataSpesa.SelectedDate;
               Pagamento: dropPagamento.Selected;
               Fornitore: txtFornitore.Value;
               Note: txtNote.Value;
               DataRimborso: dateDataRimborso.SelectedDate;
               IDRimborso: txtIDRimborso.Value
               })
               
       )
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 531 Most Valuable Professional

#2
Haque Profile Picture

Haque 261

#3
Kalathiya Profile Picture

Kalathiya 221 Super User 2026 Season 1

Last 30 days Overall leaderboard