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

transfer data from collection to sharepoint list/excel online

Hi. 

 

this is the context: i have 3 different screens. each screen shows a different subject. Under each subject, there are about 10 courses for users to choose from.

 

I used OnCheck -> Collect(CoursesSelected, {Name: CourseName.Text, Credits: CourseCredit.text}), OnUncheck -> Remove(CoursesSelected, {Name:CourseName.Text, Credits: CoursetCredit.text}) for me to record the courses the users have made on each Subject. 

 

i then placed this collection as a gallery in a new screen called "View Courses Selected". 

 

Here comes my problem. I would like to record the entry(Courses selected) of this user in a new sharepoint list / excel sheet. So when he clicks "confirm courses selected", the data (Course Names, Course Credits of every course the user selected) will be collected automatically on sharepoint/excel.  Is there a way to transfer the data from my Collection to an external source without the user filling in any blanks?

 

Do i have to make use of Flow or Patch or anything that can make this work please let me know!!!!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: transfer data from collection to sharepoint list/excel online

First you need to create a corresponding SharePoint List, or Excel table with the related columns.

 

Then within PowerApps, we could take use of the Patch () function to submit the collection into SharePoint list.

For example:

Forall(CourseSelected, patch(SharePointList, defaults(SharePointList), {Fieldmatch}))

One thing should be take notice of is make sure the collection and the SharePoint field Name could be distinguished.

 

For how to use patch, see:
Patch() function in PowerApps

 

Regards,

Michael

Community Support Team _ Michael Shao
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

6 REPLIES 6
Highlighted
Community Support
Community Support

Re: transfer data from collection to sharepoint list/excel online

First you need to create a corresponding SharePoint List, or Excel table with the related columns.

 

Then within PowerApps, we could take use of the Patch () function to submit the collection into SharePoint list.

For example:

Forall(CourseSelected, patch(SharePointList, defaults(SharePointList), {Fieldmatch}))

One thing should be take notice of is make sure the collection and the SharePoint field Name could be distinguished.

 

For how to use patch, see:
Patch() function in PowerApps

 

Regards,

Michael

Community Support Team _ Michael Shao
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

Highlighted
Advocate II
Advocate II

Re: transfer data from collection to sharepoint list/excel online

What do you mean with: "One thing should be take notice of is make sure the collection and the SharePoint field Name could be distinguished."

 

When I try to Patch my collection I have an error since Patch expects a record and the collection is a table of records.

using the forall with the collection I'd get the records one by one but I don't know how to pass the whole record to the patch.

 

I tried as well using Collect to insert the table of records (my collection) in the SP List but it doesn't work either because of the automatic generated columns, then I removed them with Dorpcolumns, but then I get an error 2 with the Attachment column "Field Requiered"

 

What I try to do is archive items from one SP List into another one. So I build a Collection with a Filter of the first List then try to add this Collection to the archived SP List...

I manage to do it using forall Patch record by record and column by column but is a pain...

Highlighted
Advocate II
Advocate II

Re: transfer data from collection to sharepoint list/excel online

Finally I found out!

instead of clearing the columns with DropColumns I had to clear the collection with ShowColumns so that it makes sure you only have the data columns you really need. Then Collect (Sharepoint, Collection) works like charm.

Highlighted
Regular Visitor

Re: transfer data from collection to sharepoint list/excel online

Hi Guys - I hope someone can help me with my issue. I have a sharepoint list and the columns there are not single line of text but choices. On the other hand, I want to upload an excel file via collect function. Now, if I am using the for all, for those columns that are configured as choices in the sharepoint list, I am encountering an error because of the format type. Can someone share their code on this kind of things?

 

MyCode for now is ForAll(col_Employee,Patch(CollectedResult,Defaults(CollectedResult),{Title:"Done",Director:Director,InputProvider:InputProvider,
Employee:Employee,EmailAddress:EmailAddress,Activity1:Activity}))

 

Activity1 is the choices column in the sharepoint list. 

Highlighted
Advocate II
Advocate II

Re: transfer data from collection to sharepoint list/excel online

.

Highlighted
Advocate II
Advocate II

Re: transfer data from collection to sharepoint list/excel online

hi Vier,

I don't know where you get the info to pass to the Patch function but assuming the data is the right type, then what I have as a good practice in order to make sure I pass the right data is the use of Field disambiguation, so in your case would be something like:

 

 

ForAll(col_Employee,Patch(CollectedResult,Defaults(CollectedResult),{Title:"Done",Director:col_Employee[@Director],InputProvider:col_Employee[@InputProvider],
Employee:col_Employee[@Employee],EmailAddress:col_Employee[@EmailAddress],Activity1:col_Employee[@Activity]}))

 

 

I suppose you get the ALL data from col_Employee. Another thing that helps when using choice fields is getting the data through a ComboBox or Dropdown with Items = Choices(...) so that you 're sure to get the right type of data.

 

In your case if Activity is an input field I recommend you to use a Dropdown and assign the Items property to Choices( your choices). This way when you pass it to the Patch function you're sure to have the right stuff

 

I hope it helps

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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