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 / Patch function + not o...
Power Apps
Answered

Patch function + not overwriting values in sharepoint list (add values with separator)

(0) ShareShare
ReportReport
Posted on by 10

I have a power app application that contains a gallery that is linked to a sharepoint list. I have created a collection from the gallery that is modified in various ways and as a result I need to upload the data from the collection back into the sharepoint list to an already created records (by ID). I figured this out with this code:

 

Onselect property of button:

 

 

Patch('SharepointlistName', ForAll(collectionName As _item,{ID: _item.ID, Column: _item.Column}))

 

 

 

But what I also need (and I don't know if this is possible) is that the value (Column) , which is sent from the collection, does not overwrite the value that is already in the cell in sharepoint list for the right item, but just adds another value that would be separated by ;

 

Like this:

For item 1 (which is already created in sharepoint list) value = 5 is sent from power apps

In sharepoint list should look like this: 5;

For item 2 (which is already created in sharepoint list) value = 1 is sent from power apps

In sharepoint list should look like this: 1;

 

Sharepoint list:

TitleColumn
Item 15;
Item 21;

then the next modification takes place in powerapps:

For item 1 (which is already created in sharepoint list) value = 2 is sent from power apps

In sharepoint list should look like this: 5;2;

For item 2 (which is already created in sharepoint list) value = 3 is sent from power apps

In sharepoint list should look like this: 1;3;

 

Sharepoint list:

TitleColumn
Item 15;2;
Item 21;3;

 

and on and on...

Can I ask for advice?

Thank you

 

Categories:
I have the same question (0)
  • Verified answer
    WiZey Profile Picture
    3,023 Moderator on at

    Hello @mayaministr ,

     

    To accomplish this, I think you'll need to upgrade your "Patch()" function.

     

    Right now, it's only creating new records from the collection, but it'll need to do both creation and modification on the same call.

     

    I believe the formula below should work:

     

    Patch(
     'SharepointlistName', 
     ForAll(
     collectionName As _item,
     If(
     IsBlank(LookUp('SharepointlistName', ID = _item.ID)),
     Defaults('SharepointlistName'),
     {ID:_item.ID}
     )
     ),
     ForAll(
     collectionName As _item,
     With(
     { _record: LookUp('SharepointlistName', ID = _item.ID) },
     If(
     IsBlank(_record),
     {
     ID: _item.ID,
     Column: _item.Column & ";"
     },
     {
     ID: _item.ID,
     Column: _record.Column & _item.Column & ";"
     }
     )
     )
     )
    )

     

    To break it down quickly:

     

    In the first "ForAll()", I build a list of new record and existing records. New records are created with "Defaults()" and existing records a retreived with {ID:_item.ID}.

     

    In the second "ForAll()", I build the same list, however, I input the values from your app as is for new records and concatenate the values with the record's column for existing records.

     

    Also I attached a semi-colon ";" before each column as you requested.

     

    It's a bit far-stretched, so I can't guarantee it'll work on the first try. Can you give it a go and see how it works?

  • mayaministr Profile Picture
    10 on at

    Thank you very much, it works perfectly!

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 421 Most Valuable Professional

#2
11manish Profile Picture

11manish 153 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 116 Super User 2026 Season 2

Last 30 days Overall leaderboard