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

Help! Create multiple list items from form

So I am not too sure where to even start with this one. I have an app where i would like to have a form that you could fill in all the details about 10/11 fields which goes into a sharepoint list. One field is customer, i currently have a combo box in there so we can select more than one but currently it just concatenates this so the customer shows "Customer 1, Customer 2, Customer 3" ideally what i would like is for when submitting this form it would create 3 seperate rows in the list with all the information the same but just with one customer name in each. So then afterwards we can put in individual stats that relate to just that partner. 

 

For example: 

Current view:

Computer screen | 12/08/19 | Colette | Customer 1, Customer 2, Customer 3

 

What i would like:

Computer screen | 12/08/19 | Colette | Customer 1

Computer screen | 12/08/19 | Colette | Customer 2

Computer screen | 12/08/19 | Colette | Customer 3

 

Hopefully that makes sense any ideas? 

1 ACCEPTED SOLUTION

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @Coletteb425 ,

I think you could create a collection that is the same as table2 and then update with the data of the collection.

For example:

ClearCollect(test,
RenameColumns(
AddColumns(Combo box1.SelectedItems,
"column1","Computer screen","column2","12/08/19","column3","Colette"
), //create a collection that is same as the table that you want
"Value",
"customer" //the value of combo box's fieldname is Value by default, change it to its fieldname in the list
);
Collect(listname,test) //update the list with the data of the collection

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Jeff_Thorpe
Super User
Super User

You could be able to loop through the selected customers using ForAll and use Patch() to create a new record for each customer.

 

Since I don't know all the details of the Form and the fields/input controls used, I can't give you a great example but in general it would like something like this:

 

ForAll(Customer.SelectedItems, Patch(SPList, Defaults(SPList), {Customer:Results , Title:InputControls, ......}))



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
v-yutliu-msft
Community Support
Community Support

Hi @Coletteb425 ,

I think you could create a collection that is the same as table2 and then update with the data of the collection.

For example:

ClearCollect(test,
RenameColumns(
AddColumns(Combo box1.SelectedItems,
"column1","Computer screen","column2","12/08/19","column3","Colette"
), //create a collection that is same as the table that you want
"Value",
"customer" //the value of combo box's fieldname is Value by default, change it to its fieldname in the list
);
Collect(listname,test) //update the list with the data of the collection

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Haze
Frequent Visitor

I am having a very similar problem, I need to use patch() to create multiple list items in one click but, I want one column to be unique in each record. This value will be selected out of the combobox. The current issue is getting the patch to write unique values.

Below is an oversimple example

Date: Today()

Name: TextInput.Text

ForAll(ComboBox_Tasks.SelectedItems,Patch('SPList',Defaults('SPList'), {'Name': Name_Input_1.Text},{'Evaluator': Evaluator_Input_Txt_1.Text},{'Qualification Date':Date_Completed_4.SelectedDate},{'Expiration Date': DateAdd(Date_Completed_4.SelectedDate,3,Years)}, {'Task Name': ???

How would I have it fill for each selected item in the combo box?

@Jeff_Thorpe 



Coletteb425
Frequent Visitor

So I managed to do this in the end @Haze you are basically there you just need the one that is repeated to bring back the result so I assume task name is the one you are selecting in ComboBox so you just need to put either result in or name of the data source that the combobox is pulling from. 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,024)