I have an app where a ClearCollect is used on a filtered datasource. Sometimes (but not always) this results in all entries being duplicated in the collection.
The ClearCollect is in a Concurrent function where there are multiple other ClearCollects (different collections).
The issue occurs only on Android (never seen it on iOS or browser) and happens with both SharePoint list and Azure SQL DB datasources.
Anyone else seen this?
Is this a known issue?
Hi @PaulD1 ,
I just tested with ClearCollect on Android and I cannot reproduce your issue. What is the exact formula? Where did you put this formula?
The issue is intermittent, but we've had several users see this, but only on Android devices (never in the browser or on iOS).
My App populates local collections (using ClearCollect) based on a simple filter on a SQL datasource - an example is shown below:
ClearCollect( colMyCultivar, Filter( '[ChemRec].[Cultivar]', User = Text(varCurrentUserID) ) );
The data does *not* contain any duplicates.
Restarting the App (so that the ClearCollect fires again) usually resolves the issue.
Still seeing this issue 😞
Although I can't currently reproduce it in my environment I have users sending me screenshots of this happening intermittently on both Android and Windows (
browser) Edit - App, not browser.
I'm doing a number of simple ClearCollects (as per original post) wrapped in a Concurrent statement. There is no duplication in the source data. Intermittently, every record will appear twice in the collection after the ClearCollect commands have been run.
Example below - sometimes the options will be duplicated, sometimes not. Each option only appears once in the source data set.
I was using LoadData to populate collections from the device cache. Users were then able to hit a sync button to start a sync process to upload new data (if there is any) to the data source (Azure SQL DB) followed by a ClearCollect to replace all data in the collections (so local data gets loaded into the PowerApp on start, and on button press any new/modified/deleted records are pushed to the server, finally all records are pulled back from the server into the collection).
The LoadData command was on AppStart.
If the user hit the sync button very quickly we would get duplicates.
I believe what was happening was that LoadData in the AppStart was running aysonchronously and allowing the user to hit the sync button while still pulling in data from the local cache. If there was no data to upload, the ClearCollect was running while the LoadData command was still running and so we ended up with records being added to the collection both from the LoadData and the ClearCollect, doubling up on the records.
I moved the code out of AppStart and also put a timer in place to give two seconds between the LoadData command being called and the ClearCollect being called. So far we have been unable to reproduce the duplication error.
This is only what I can determine by watching what is going on. If I'm correct this is a bug and I believe the LoadData command needs to block the ClearCollect command until the LoadData has completed rather than allowing the merging of records from the two sources.
Check it out!
Fill out a quick form to claim your user group badge now!
Find out where you can attend!
Features releasing from October 2019 through March 2020
The largest Power BI, Power Platform, and Data conference in New Zealand