cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Barberdc
Level: Powered On

Patch and Collect overwriting same record in excel file

Hi all, I am creating an app to store an employees skills using simple excel files to represent each 'table' of data. I have a Gallery that a user can select one or more skills from the master list, which is stored in a collection. The user then proceeds to the next screen where a gallery (based on the collection used as a filter) presents the subset of skills the user wants to add. Each gallery item allows the user to enter a bit more info about each skill. Once the user is finished with the selected gallery item they can click a button to add their skill to the excel data source that stores all employee skills.

 

My issue is that every time the user clicks the action button a single record is created in the excel file, each subsequent submission just overwrites the same excel record each time so there is only ever one record in the excel file.

 

If have used both patch and collect, both successfully creating a record but there will only ever be one record in the excel file, instead of continually adding more and more records to the file. The reason for using a gallery instead of a form is so the user can rapidly enter multiple skills at a time.

 

Anyone any ideas what I am doing wrong, I am sure it's something simple.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Barberdc
Level: Powered On

Re: Patch and Collect overwriting same record in excel file

Hi @Drrickryp, thanks for the quick reply. I think it was me being impatient and not waiting enough time for the manual record deletion in excel and the refreshing of the datasource. Ensuring when I refresh my datasource I wait until I get the correct number of records in the preview before I ran my next test seems to have worked.

 

2 REPLIES 2
Super User
Super User

Re: Patch and Collect overwriting same record in excel file

Hi @Barberdc,

We would need to see your Patch() and Collect() or ClearCollect() functions to see what is going wrong. Collect() adds one or more new records to a collection.  Repeating the Collect() function using the same collection name simply appends a new record to the  already exisiting collection.   ClearCollect() erases the collection and adds one or more new records. Neither Collect() or ClearCollect() can edit an existing record.

Patch() is a bit more complicated.  It can add a new record to a collection the same way Collect() does or it can edit a record and change the field values in an existing record.   I suggest that you spend 20 minutes reviewing @Shanescows (Shane Young's) You Tube PowerApps Save Data - Patch, Collect, and ForAll - at 

https://www.youtube.com/watch?v=MclJ_O9HvJQ  

Barberdc
Level: Powered On

Re: Patch and Collect overwriting same record in excel file

Hi @Drrickryp, thanks for the quick reply. I think it was me being impatient and not waiting enough time for the manual record deletion in excel and the refreshing of the datasource. Ensuring when I refresh my datasource I wait until I get the correct number of records in the preview before I ran my next test seems to have worked.

 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

Follow PowerApps on Twitter

Stay Up-to-Date by following PowerApps on Twitter

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

Users Online
Currently online: 43 members 4,546 guests
Please welcome our newest community members: