cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

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
Highlighted
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
Highlighted
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
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (6,941)