cancel
Showing results for 
Search instead for 
Did you mean: 

WaitUntil and Sleep functions

Ideas

  • WaitUntil function which accepts a boolean (true or false) value as the parameter and causes the app to wait until that boolean value is true
    • Example - Waiting until a patch is complete to navigate to a different screen
  • Sleep function which takes a time in milliseconds as the parameter and causes the app to sleep for that specified time

These two functions would be very helpful in a variety of situations and I believe they would positively impact the flow of my applications. 

Status: New
Comments
Gargoolgala
Resolver II

Hi,  whle I agree a wait/sleep option would be ideal the way I get around this is to create a timer and then action the item I need doing next on the TimerEnd option.

 

This works for the sleep option but not wait as you have to experiment until you ge tthe timer duration right.  

RusselThomas
Microsoft

Timer option doesn't help within a ForAll - I'm hitting API quota limits (submissions per second) - would be handy to have it wait even 1 second before processing the next record.

Right now I'm farming off a request to flow which responds after a 1 second wait time - what a waste of flow quota!

PaulD1
Super User

Ability to force PowerApps to wait for a process to complete before contuing to the next command would be great. My suspicion is that asynchronous behaviour can change somewhat from version to version so to be able to confidently force PowerApps to wait for a Patch to complete (for example) before changing screen / refreshing / whatever would be welcome.

ArjenHofland
Regular Visitor

Wait untill is basically a need to have if you want to keep your code neat and always working properly in certain scenario's.

 

I for one, would be ever so thankfull for this. For the timer only works if the request is acually handled within that particular timeframe. If for whatever reason it takes longer, the logic fails. 

PaulD1
Super User

In the specific case of waiting for a Patch to complete, I think you may be able to force that by assigning the output of a the Patch to a variable - something like:

UpdateContext({conPatchID:
Patch(tblPatchTable, Defaults(tblPatchTable),{Column1: "My Value"})
);
If(conPatchID.ID > 0, Navigate(NextScreen,Fade)

This is a bit of a hack though and no guarantee that the behaviour of such a construct won't be changed in the future.

There are many other times when you want a specific command/set of commands to complete (say, loading a dataset into a local collection) before moving onto the next command so having a Wait command that you could wrap around multiple statements (like Concurrent) would be a great addition.

MiryamStella
Regular Visitor

I see this idea was posted back in June 2018. The waitUntil / doWhile funtions are a must. 

I have seeing posts from very clever people doing their best to solve this problem... because it is a problem let's face it. It should not be this hard.

Is there a way we can promote the idea?

jdarling20
Helper I

Yes, absolutely. I've recently discovered a pattern to create a semi-callback condition by using toggles and global variables for start/stop which is fantastic. The issue I have though is that I can't force my next code that executes to wait until the underlying "callback" has completed. All it does is wait until the global variable is set to TRUE, which happens instantaneously.

 

In React there is a pattern in calling a callback which requires another to complete first before this can run. That's what I think we're looking for here.

dee2005
Advocate III

@PaulD1 sounds like a good idea but updatecontext is not allowed in a forall ☹️

PaulD1
Super User

@dee2005 although updatecontext can't be used in a ForAll I believe you can Patch to a local collection within a ForAll. However, I think MS 'reserve the right' to process ForAll in any order they like (or possibly concurrently) so you may get unexpected results.

Given that this suggestion is still marked as 'NEW' after 3+ years I don't think a Wait Until... feature/function will be coming 😞