web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Android: ClearCollect ...
Power Apps
Unanswered

Android: ClearCollect resulting in duplicate entries

(0) ShareShare
ReportReport
Posted on by 2,914

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?

Thanks

Paul

Categories:
I have the same question (0)
  • v-monli-msft Profile Picture
    on at

    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?

     

    Regards,

    Mona

  • PaulD1 Profile Picture
    2,914 on at

    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.

  • PaulD1 Profile Picture
    2,914 on at

    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.

     

    Duplicates.png

  • PaulD1 Profile Picture
    2,914 on at

    Further update...

    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.

     

  • MariaOseguera Profile Picture
    7 on at

    hi, i know this is a closed matter but i have the same issue. My "hidden" loaddata button everytime that the user syncs the info, duplicates the first record of the collection, sometimes once and sometimes creates "n" duplicate records for ONLY the first one shown in the collection. My loaddata is activated when the screen is onvisible and then everytime the user syncs, what should i do here? how can i add the timer if thats the answer?

  • PaulD1 Profile Picture
    2,914 on at

    Hi @MariaOseguera  

    I have found that the LoadData and SaveData commands run at a truly glacial pace in PowerApps (literally faster to pull data from another continent than to move data from persistent to volatile storage - i.e. from the Saved data back into a Collection). This is especially the case if you are dealing with things like images. 

    IIRC we had to set the sync button to be disabled for the first few seconds are the App opens. Maybe you could do similar in your onvisible event.

    You'll need to add a timer control to your form. Set it to autostart (when the screen becomes visible), set a duration of say 2000ms. In the OnTimerStart event set some variable to false and set your button's display mode to be View while the variable is false. In the OnTimerEnd event, set the variable to true.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard