cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Unusual Collect function behavior

Hi everyone.

I have a problem with Collect function. Basically application is collecting user's weekly reports. User enters the data and adds it in the collection which is the same structure (same column names) as the backing table (Excel). After entering all data, users hit submit button which after all saves collection to excel table - Collect(excel-table, collection). It works perfectly, without problems. But I add functionality that user can overwrite collection with data from excel-table from previous week, so that user doesn't have to much efforts in populating new week reports. The data copying from excel-table to collection is done without problems. User continue to update data in collection and when it hit submit again as previously stated - Collect(excel-table, collection) it doesn't store it in excel-table. One more scenario: user pulls data from previous week, update that record in collection and then add another record; when it hit submit it only store that new added record from collection, instead both records (I consider copied data from excel-table  to collection as new record to ad when the Collect(excel-table, collection) is called).

Am I missing something with the kind I am using Collect() or there is a bug in back end with Collect function?

1 REPLY 1
Highlighted
Power Participant
Power Participant

Re: Unusual Collect function behavior

@powerNewbie 

 

We do not think there is a bug here in this case.

 

We think it could be because you are attempting to "update" a record using the Collect function.

We think this is the case due to your own wording. You seem to expect a record to be updated when using the Collect function. However the Collect function is not for updating existing records, but only for creating new records.




That's also probably why you may be experiencing only seeing "Created / brand new" records using Collect.

 

You would want to use the Update function to update a record.

 

From:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-update-updateif

 

Use the Update function to replace an entire record in a data source. In contrast, the UpdateIf and the Patch functions modify one or more values in a record, leaving the other values alone.

 

From:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-clear-collect-clearc...

Collect

The Collect function adds records to a data source. The items to be added can be:

  • A single value: The value is placed in the Value field of a new record. All other properties are left blank.
  • A record: Each named property is placed in the corresponding property of a new record. All other properties are left blank.
  • A table: Each record of the table is added as a separate record of the data source as described above. The table is not added as a nested table to a record. To accomplish this, wrap the table in a record first.

When used with a collection, additional columns will be created as needed. The columns for other data sources are fixed by the data source and new columns cannot be added.

 

 

 

 

 

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,234)