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 / Asynchronous Function ...
Power Apps
Answered

Asynchronous Function Executing

(0) ShareShare
ReportReport
Posted on by

Hi All,

 

I have a button with the following code

 

RemoveIf(datasource, GUID = Var_GUID);
Collect(datasource, {GUID = Var_GUID, xxxxxx});

 

Basically, it is to remove all the existing records and collect a set of new.

 

The issue I encounter is that second collect function does not always execute as expected,
The thought in my mind is that the first syntax is still being executed then the second started therefore a conflict.

 

Anyone have affirmative mechanism or how to solve it?

Categories:
I have the same question (0)
  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    Hi @Anonymous ,

    Any specific reason to use Collect instead of ClearCollect?

  • Verified answer
    v-bofeng-msft Profile Picture
    on at

    Hi @Anonymous :

    The formulas separated by ";" in the Canvas app are executed in order. RemoveIF must have been executed before the Collect is executed.

    I suggest you check whether there may be a problem with "{GUID = Var_GUID, xxxxxx}" (for example, whether there are duplicate values in a field that does not allow duplicate values).

    In addition,maybe you could try this formula:

    RemoveIf(datasource, GUID = Var_GUID);
    Refresh(datasource);
    Collect(datasource, {GUID = Var_GUID, xxxxxx});

    Best Regards,

    Bof

  • Community Power Platform Member Profile Picture
    on at

    Hi Thank you for your reply.

     

    I also noticed that, my previous concern was it is just an order sending to the server.
    While server takes time to execute, the second syntax is excuting before the server finishes.

     

    Now I know the order is executed only when the previous one finishes

  • KeithHo1 Profile Picture
    4 on at

    I found that PowerApps does not wait for the completion of the refresh function before executing the next function. Are there any asynchronous or .then functions available to make the app wait for the refresh? Currently, I'm only using a timer to wait for 3 seconds before refreshing.

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 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard