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 / Patching a collection ...
Power Apps
Unanswered

Patching a collection to a table

(0) ShareShare
ReportReport
Posted on by 15

Greetings,

 

I am attempting to patch a collection to a table because I need to add multiple values from a combo box to my table. This guide I am following shows me how to, but with a SP list. I have tried my best to follow along, but have ran into some issues. The following code is the code I have tried:

ForAll(
	ComboBox1.SelectedItems,
	Collect(
		colCoatingsToPatch,
		{
			Coating: ThisRecord.Coating
		}
	)
);

Patch(
	RollerData,
	Defaults(RollerData),
	{
		coatingMultiple: colCoatingsToPatch
	}
);

 

where Coating is a text data type and coatingMultiple is a Lookup. I have also tried changing Coating to coatingMultiple in the Collect function which doesn't work. coatingMultiple in the Patch function expects a Record, but is given a Table.

 

Any help is appreciated, thank you.

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

    Hi @raindance 

     

    Looks like you are trying to patch multi Lookup. Please try this.

     

    Patch(
    	RollerData,
    	Defaults(RollerData),
    	{
    		coatingMultiple: ForAll(
     ComboBox1.SelectedItems,
     {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
     Id: Id,
     Value: Value
     }
     )
    
    	}
    );

     

  • raindance Profile Picture
    15 on at

    hi @StalinPonnusamy ,

     

    Unfortunately, that didn't work. It says it's an error. I should've mentioned this, but the data source is a Table, not sure if that changes anything.

    FQdMDsk.pngJy0cCEA.png

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @raindance

     

    By looking at the error, you are using Dataverse (new_CoatingMultiple). Is it correct?

     

  • raindance Profile Picture
    15 on at

    Hello @StalinPonnusamy ,

     

    That is correct, I am using Dataverse. I don't think I am able to switch to SharePoint lists, even though it seems that everyone is using it and have no issues with it.

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    No problem. Let me work on this and update you.

     

  • raindance Profile Picture
    15 on at

    hey @StalinPonnusamy any update on the solution?

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @raindance 

     

    In this example, the Account has only one Primary contact. So Patch command will be

    Patch(
     Accounts,
     LookUp(
     Accounts,
     Account = BrowseGallery1.Selected.Account
     ),
     {
     'Account Name': DataCardValue4.Text,
     'Primary Contact': LookUp(
     Contacts,
     Contact = DataCardValue7.Selected.Contact
     )
     }
    )

     

    But Account may have more than one contact, in this case, we need to create contacts with Account lookup

    ForAll(
     Combobox1.SelectedItems,
     Patch(
     Contacts,
     Defaults(Contacts),
     {
     'Company Name': BrowseGallery1.Selected
     }
     )
    )

     

  • raindance Profile Picture
    15 on at

    Hi there @StalinPonnusamy ,

     

    Sorry, I don't fully understand your example. I'm also pretty new to powerapps so bear with me please.

    I have basically replaced your example with my variable names, so it looks like this:

    ForAll(
    	ComboBox1.SelectedItems,
    	Patch(
    		RollerData,
    		Defaults(RollerData),
    		{
    			Name: DataCardValue3.Text,
    			coatingMultiple: Gallery1.Selected
    		}
    	)
    );

    This works, but creates 3 copies of the record where 2 of them are blank. I also don't know how to display the final result. Did I miss a step, or was I supposed to use the first example?

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @raindance 

     

    Need to utilize Combobox to get value. Based on your Combobox, need to select a value like Source.ColumName. So that it adds the selected data from Combobox

     

    ForAll(
    	ComboBox1.SelectedItems As Source,
    	Patch(
    		RollerData,
    		Defaults(RollerData),
    		{
    			Name: Source.Name,
    			coatingMultiple: Gallery1.Selected
    		}
    	)
    );

     

     

    In this example, Combobox displays the last name, so getting Lastname from combo like Source.Lastname 

    ForAll(
     DataCardValue7_1.SelectedItems As Source,
     Patch(
     Contacts,
     Defaults(Contacts),
     {
     'Last Name': Source.'Last Name',
     'Company Name': BrowseGallery1.Selected
     }
     )
    )

     

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @raindance 


    Please let us know if anything needs on your post. We can help with this.

    Please do not forget to give kudos if you find the suggestion helpful or Accept it as a solution if works fine to help other users to find it useful.

    Thanks,
    Stalin - Learn To Illuminate

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
Haque Profile Picture

Haque 94

#2
WarrenBelz Profile Picture

WarrenBelz 82 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 38 Super User 2026 Season 1

Last 30 days Overall leaderboard