web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch Collection to Si...
Power Apps
Unanswered

Patch Collection to Single Row in SharePoint

(0) ShareShare
ReportReport
Posted on by 30

Hello,

 

I'm looking to take my collection (that has several rows of data) and patch it to a single row within a separate SharePoint data source.

 

I can use either Patch or Collect and reference the Collection and it saves to SP just fine, but always adds multiple rows. 


I need only a single row of data to track changes to fields. Every time certain fields change, I have the On Change to collect each value and store it in the collection, I then need to take this whole collection and save as a single row in SP with an ID listed.

 

Any thoughts on how to accomplish? I feel like it's something very simple I am missing and just can't figure out what formula to write.


Thanks so much!

Categories:
I have the same question (0)
  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    Patch(

    //Item from Collection (you can use a LookUp, for example) ,

    Defaults(YourDataSource),

    {

    ...

    }

    )

     

    https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-patch

     

    If you need additional help please tag me in your reply and please like my reply.
    If my reply provided you with a solution, pleased mark it as a solution ✔️!

    Best regards,

    Gonçalo Nogueira

    Check my LinkedIn!

    My website!

    My blog!

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @drewdev 

    Use Concat() to convert a table into a single row of strings

    Concat(yourcollection, Value, ", ")

    You can replace Value with the name of the column in your collection that you want to convert to a string.

    so

    Patch(splist, Defaults(splist),{somecolumn: Concat(yourcollection, Value, ", ")})

  • Andrew5715 Profile Picture
    30 on at

    So I saw Concat.. but wasn't sure how to write the Value piece.. I need to concat every row vs. a few fields - is there an easy way to write this so I dont have to write out every single field? (there is like 10-15 fields so trying to avoid this and just have it automatically convert the entire collection to a single row)

  • Andrew5715 Profile Picture
    30 on at

    This is patching to an already existing value in SP.. not what I need to do unfortunately as the new row is being created with a button within PA 

     

    I need to write all values from Collection to a single NEW row within SP - hope that helps clarify.

     

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @drewdev 

    Please post a screenshot of your collection 

  • Andrew5715 Profile Picture
    30 on at

    So I have this collection being populated - I need both rows to be combined so that the 3 possible fields all save to SP in one row:


    Actual Monthly Volumes 

    Forecasted Monthly Volumnes

    Intake_ID

    Right now it saves to SP as 2 rows vs just a single one. Hope this helps!

     

    Screenshot 2022-11-29 124527.png

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @drewdev 

    Does this work?

     Concat(
     colBenefitChanges, Concatenate(
     Actual_Monthly_Volumes, ", ",
     Forcasted_Monthly_Volumes, ", ",
     Intake_ID
     ),";"
    )
  • cwebb365 Profile Picture
    3,294 Most Valuable Professional on at

    I would just use the JSON function. You can just feed it the collection and it will dynamically put it to Text. Althou it's in JSON format, but it makes it usable if you need to reference in Flow or other API's etc. There is the new ParseJSON() function as well (Experimental) that you can use to Read JSON back into collections etc. 

     

    That's how I've been handling things like that. Makes it dynamic and reusable. Anyway, hope this helps.  

     

    Also, be mindful of your max character limits in your column you save this data. You can only store so much into SharePoint columns. 

  • Andrew5715 Profile Picture
    30 on at

    I'm not seeing how that would apply the item directly to the SP list 

     

    Here is what I'm using to get the collection into SP: 

     

    Patch(SPList,colBenefitChanges)   

    or

    Collect(SPList,colBenefitChanges)

     

    This submits the entire collection into separate rows, where would I include the Concat piece? I tried copying what you had and got an Expected Record error. 

  • Andrew5715 Profile Picture
    30 on at

    I like the idea, although I haven't messed with JSON too much in this specific type of way (only Flows). 

    Any documentation on how to do what I'm looking for? Patch an entire collection of data into a single SP row? 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard