cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MikeLockwood
Advocate IV
Advocate IV

Code not executing in sequence

I am doing something I thought was relatively simply.  I want to show a "Preloader" while an action is occurring and once it finishes, hide the preloader, simple enough right.  Not so much.  So basically I have the preloader as a top level object.  On a button click the following actions happen.

 

Show Preloader

Set preloader message

 

Hide form

 

ClearCollect (based on selection from form

 

Hide Preloader.

 

The problem is the preloader never shows up because the clear collect is running.  Why is this no happening sequentially?  

 

Any thoughts?

Thanks,
Mike L.
1 ACCEPTED SOLUTION

Accepted Solutions

@MikeLockwood ,

Yes that will happen if the code executes quickly. Unless you want to use a timer for a second or so and add the rest of the code when the timer ends.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

6 REPLIES 6
Krishna_R
Responsive Resident
Responsive Resident

Hi @MikeLockwood 

that might mostly because of using clearcollect() 

try clear() and collect()

show spinner

clear()

collect(your formula)

hide spinner

WarrenBelz
Super User
Super User

Hi @MikeLockwood ,

Assuming pre-loader is an icon or label here set the visible property to a Variable (varLoading used)

UpdateContext({varLoading:true});
ClearCollect( . . . . .);
UpdateContext({varLoading:false})

The Visible on the pre-loader

varLoading

The Visible on the Form

!varLoading

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

I will have to give that a Shot.  I am also going to see if the query works against SharePoint direct instead of pulling everything into a collection.  Trying to avoid issues with delegation and the records limit.

Thanks,
Mike L.

Warren,

 

This is exactly what I am doing but it seems that before the preloader has a chance to actually become visible the code is on to the clear collect.

Thanks,
Mike L.

@MikeLockwood ,

Yes that will happen if the code executes quickly. Unless you want to use a timer for a second or so and add the rest of the code when the timer ends.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

WarrenBelz
Super User
Super User

Hi @MikeLockwood ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,135)