cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
d3ell
Level: Powered On

Patching a collection

Hi, I’m trying to duplicate one part of a form when opening a new form. to explain my form contains several sections, the first part contains all the customer data. Ie. Name, Address, Contact no’s, email etc etc. The second and third part of the for are specific for a job so these are always going to be different, however the customer details could be the same for several records so what I want to achieve is to copy the 1st part of the form and then on a new form be able to paste this data so that we can move straight on to entering the job data rather than re-entering all the customer data.

My thoughts on achieving this was to create a button on the form that copies the required fields to a collection (I have managed to do this and I have a collection called “Copy”.
I then have a button on a new form that saves paste copied data and I’m wanting to paste the items in the collection and then clear the collection so that the collection can only have 1 record at a time.

I’m struggling to work out how to patch the data?

I have tried

Patch(Copy,{Customername:Customernamecopy})

The patch formula would ultimately contain a lot more records, but just trying to get it to work with one at first.

Any ideas?

Struggling to find much info on the patch function for this sort of use?

Is it possible!?

Thanks
1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Patching a collection

Sure thing, but in this case you are dealing with a collection and trying to patch it.  So, you will need the collection name, a record and then your updates.

   Patch(CollectionName, Record, Changes)

 

You could (since you say your collection ONLY has one record in it) do this:

   Patch(Copy, First(Copy), {Customername:Customernamecopy})

 

If you want to break away from that paradigm, you might consider using a variable instead.  Then your original logic for Patching would work.  But, again, you are using a collection, so you need a record to identify and patch.

 

Something like this would be a shift way from that collection:

   Set(varCopy, {Customername:<someOriginalValue>theRestOfYourColumns : andTheirValues})

 

Then when you are trying to do that patch, it would be like this:

   Set(varCopy, Patch(varCopy, {Customername:Customernamecopy}))

 

(Notice that patch returns the actual record, so you just have to remember to "Set" your variable with it. Otherwise it goes nowhere.)

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

1 REPLY 1
Super User
Super User

Re: Patching a collection

Sure thing, but in this case you are dealing with a collection and trying to patch it.  So, you will need the collection name, a record and then your updates.

   Patch(CollectionName, Record, Changes)

 

You could (since you say your collection ONLY has one record in it) do this:

   Patch(Copy, First(Copy), {Customername:Customernamecopy})

 

If you want to break away from that paradigm, you might consider using a variable instead.  Then your original logic for Patching would work.  But, again, you are using a collection, so you need a record to identify and patch.

 

Something like this would be a shift way from that collection:

   Set(varCopy, {Customername:<someOriginalValue>theRestOfYourColumns : andTheirValues})

 

Then when you are trying to do that patch, it would be like this:

   Set(varCopy, Patch(varCopy, {Customername:Customernamecopy}))

 

(Notice that patch returns the actual record, so you just have to remember to "Set" your variable with it. Otherwise it goes nowhere.)

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (5,490)