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 Records to sql s...
Power Apps
Unanswered

Patch Records to sql server table using collections

(0) ShareShare
ReportReport
Posted on by 30

Hi Community,

I'm struggling to get the formula when there is one collection ie., Collection1 which consists of three columns Name, Email, ItemID and second collection containing three columns ItemName, ItemDescription, Quantity. I would like to Patch records to a sql table which has four columns Item, ItemName, ItemDescription,Quantity. What would be the formula in these scenarios where ItemID is in one collection and ItemName, ItemDesc and Quantity are in another collection. Do I need to use ForAll to update multiple records in sql server?

 

Thank you!

Categories:
I have the same question (0)
  • v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @Kitz ,

     

    Do you mean that the second collection is the nested table of Collection1 like the left of screenshot?

    What is the column name of  second collection in Collection1?

    You can try to use Ungroup function to expand the nested table to be like to the right of screenshot.

     

    ClearCollect(CollectionUngroup, Ungroup(Collection1,<GroupColumnName>))

    Note: GroupColumnName is the Column name of second collection.

     

    Once the nested table is expanded, just use patch function to patch the record.

    For example: 

    Patch('SQL table', BaseRecord, {ItemID: First(CollectionUngroup).ItemID,ItemName: First(CollectionUngroup).ItemName, ItemDesc: First(CollectionUngroup).ItemDesc, Quantity: First(CollectionUngroup).Quantity })

    Annotation 2019-09-26 112321.png

    Best regards,

    Sik

     

     

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,033

#2
Valantis Profile Picture

Valantis 632

#3
11manish Profile Picture

11manish 607

Last 30 days Overall leaderboard