cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PankajChaudhary
Frequent Visitor

Patch Function Save data to Sharepoint list from Form control and Collection datasource.

Created form in two parts:

  1. Using Form control
  2. With multiple TextInput box (152 Boxes) and Saving those data to Collection Datasource. I had to use bulk TextInput boxes to give excel sheet look for data fill in.

Here I am trying to save both Form control data and Collection Data to sharepoint list but it gives error with below styntax.

 

 

 

Patch(SpList, Defaults(SpList), Form1.Updates,Collect(SpList,MyCollect));

 

 

 

 Please help me to figure out correct syntax for the same.

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@PankajChaudhary 

You are trying to Patch a record, another record, and a nothing to your list.  The first argument is the list, the second argument is a function (Defaults) that will return a record.  The third argument is a record that comes from the Updates property. The fourth argument is nothing as Collect does not return a value.

 

Your formula should be this:

Patch(SpList, Defaults(SpList), Form1.Updates);
Collect(SpList,MyCollect));

However, you will run into issues with the above based on the records.

I am not clear if your 152+ textinput controls are supposed to be part of the same record or something else, nor how you are storing them in the collection.

 

My suggestion would be, if they are all part of the same record submitted by the form, then skip the collection and incorporate the information into the form so that all you need to do to do this is : SubmitForm(Form1)

 

If they are to be part of some other list, then I would advise doing this the other way around.  First, skip the Patch and simply use the SubmitForm(Form1).  Then in your OnSuccess action of the form, perform your collection writing.  However again, you will want (most likely) to relate the items in your collection to the record that was just submitted.  In this case you would utilize the Form1.LastSubmit record to get the information you need.

But I do not have enough information from your post to be able to offer a suggestion on what you need to do there.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

3 REPLIES 3
CNT
Community Champion
Community Champion

@PankajChaudhary 152 Boxes ! Don't know whether to 😪 or 😀.

Anyway, could u pls share the error u r getting.

RandyHayes
Super User III
Super User III

@PankajChaudhary 

You are trying to Patch a record, another record, and a nothing to your list.  The first argument is the list, the second argument is a function (Defaults) that will return a record.  The third argument is a record that comes from the Updates property. The fourth argument is nothing as Collect does not return a value.

 

Your formula should be this:

Patch(SpList, Defaults(SpList), Form1.Updates);
Collect(SpList,MyCollect));

However, you will run into issues with the above based on the records.

I am not clear if your 152+ textinput controls are supposed to be part of the same record or something else, nor how you are storing them in the collection.

 

My suggestion would be, if they are all part of the same record submitted by the form, then skip the collection and incorporate the information into the form so that all you need to do to do this is : SubmitForm(Form1)

 

If they are to be part of some other list, then I would advise doing this the other way around.  First, skip the Patch and simply use the SubmitForm(Form1).  Then in your OnSuccess action of the form, perform your collection writing.  However again, you will want (most likely) to relate the items in your collection to the record that was just submitted.  In this case you would utilize the Form1.LastSubmit record to get the information you need.

But I do not have enough information from your post to be able to offer a suggestion on what you need to do there.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

@RandyHayes, You have correctly understood my problem. Thanks for the solutions.

 

 

 

Thanks 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (63,032)