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

Collect Function naming problem

I'm having an issue using the normal column names in my collect function when trying to write to a sharepoint list.  Its telling me on the button where the collect function is triggered onselect, that the column does not exist.  The names match both in the app and the sharepoint list.  

Problem:

Collect(
CollectShiftReport,
{

'Date and Time of notification': DataCardValue3.SelectedDate

}

);

Collect(
'Shift Report',
CollectShiftReport
)

No Problem:

Collect(
CollectShiftReport,
{

'OData_x0023_x0020_Date_x0020_and: 'DataCardValue3.SelectedDate,

}

);

Collect(
'Shift Report',
CollectShiftReport
)

 

Why do I have to type the crazy long name in???

1 ACCEPTED SOLUTION

Accepted Solutions

@long 

Because Collect creates collections.  Patch or Update/If are the only functions that will push/write data to the SharePoint List.

 

Your formula has a "DataCardValue3" control name listed in it.  This leads me to suspect that you have multiple screens with EditForms on them.  In this case, you can actually just use the built-in ability of Forms to update your SharePoint list.  No need to collect and then try to submit.

 

Take a look at this posting and the accepted solution.  It sounds similar to your needs.

 

At any rate - you're going to have to SubmitForm, Patch, or Update/If  your list.  Collect will not do anything for you except make a collection.

 

Hope this helps shed some light.

 

_____________________________________________________________________________________
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.
Check out my PowerApps Videos too!

View solution in original post

6 REPLIES 6
Super User III
Super User III

@long 

Can you explain a little more about what it is that you're actually trying to do?

You mention "writing to your sharepoint list"...but this is not the method to do that.

_____________________________________________________________________________________
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.
Check out my PowerApps Videos too!

I’m collecting data from three different forms on three different screens.  Using the collect function with a button ( onselect  using the collect function as I previously explained) on screen four to add all the data to a collection, then using the using Collect(share point list name, CollectShiftReport) to send it to my share point list.  Why is that not the correct way to do it?  Is there a better way?

@long 

Because Collect creates collections.  Patch or Update/If are the only functions that will push/write data to the SharePoint List.

 

Your formula has a "DataCardValue3" control name listed in it.  This leads me to suspect that you have multiple screens with EditForms on them.  In this case, you can actually just use the built-in ability of Forms to update your SharePoint list.  No need to collect and then try to submit.

 

Take a look at this posting and the accepted solution.  It sounds similar to your needs.

 

At any rate - you're going to have to SubmitForm, Patch, or Update/If  your list.  Collect will not do anything for you except make a collection.

 

Hope this helps shed some light.

 

_____________________________________________________________________________________
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.
Check out my PowerApps Videos too!

View solution in original post

Ok So I used your recomendation using the form functions (which does make sense) I used NewForm and  SubmitForm(StartShiftForm); SubmitForm(EquipmentCheckForm); SubmitForm(StatsForm), I have set the forms to edit mode and set the datasource for each form to my sharepoint list.  I have left item blank which I think is a problem, not sure.  My results are three entries in the sharepoint list, with data in each one from the forms??  Not sure how to get all the info on one line.

@long 

So take a look at that solution again. You will notice that on the final form is when all the submits are made. 

I would recommend that on multi-screen form entries - then it's quite simple.

If that is not an option, then you have a little more work to do.

You would need to use the LastSubmit property of your first form to "feed" the subsequent forms.

So, Form1, you do your submit.  

For Form2 and beyond, you set the Item property to Lookup(yourSharePointList, ID=Form1.LastSubmit.ID) then when you Submit those forms, they will be working on the same item in your SharePoint list.

 

I hope this makes sense and is helpful.

_____________________________________________________________________________________
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.
Check out my PowerApps Videos too!

Here's what I ended up with thats works great.  I took the three forms that are on three seperate pages and used the patch function below trigger by a button on the last page.  This takes all the form info and places it into one record on the sharepoint list.  Then reset each page and navigated back to the start screen. Thanks Randy for all you help, I really appreciate it.

 

Patch(
'Shift Report',
Defaults('Shift Report'),
StartShiftForm.Updates,
EquipmentCheckForm.Updates,
StatForm.Updates
);
ResetForm(EquipmentCheckForm); ResetForm(StartShiftForm); ResetForm(StatForm);
Navigate(StartScreen,ScreenTransition.Cover)

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

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