Power Apps Loading Spinners, Saving Spinners and Progress Bars 

Power Apps Loading Spinners, Saving Spinners and Progress Bars 

Power Apps Loading Spinners, Saving Spinners, and Progress Bars!

Overview:

Power Apps, a widely-used business solution tool, sometimes faces lags in data operations. This article guides you on how to enhance the user experience by integrating loading spinners, saving spinners, and progress bars.

Choosing and Customizing the Right Spinner for Power Apps

To elevate your Power App’s interface, first, consider the type of spinner. Obtain spinner images from online resources, such as svgbackgrounds.com. This platform offers a plethora of free spinner images and extensive customization options.

Implementing Load Spinners in Power Apps:

After downloading, integration becomes the next step. When a user selects an item from a gallery, a loading spinner significantly enhances the experience by providing visual feedback during the wait. Here’s how:

Implementing Power Apps Loading Spinners in a gallery before appearing items in it

Code Implementation

By adding specific code to the OnSelect property of the gallery, the spinner is set to appear while data loads and vanishes thereafter.

				
					// Set the showSpinner_var to true to display the spinner 

UpdateContext({showSpinner_var: true}); 

  

// Navigate to the 'DataEntryScreen' with the selected record from 'Expense Totals' 

Navigate(DataEntryScreen, ScreenTransition.None, {CurrentRecord_var: LookUp('Expense Totals', ID = Gallery2_4.Selected.ID)}); 

  

// Set the showSpinner_var to false to hide the spinner once the navigation is complete 

UpdateContext({showSpinner_var: false});
				
			
Displaying the Spinners, then proceeds to load the record through code

Uploading and Positioning

It’s essential to upload the spinner image you obtained from Loading.io to the Power Apps media section. Ideally, placing the spinner at the screen’s center guarantees visibility.

Uploading the Spinners image we obtained from Loading.io into the Power Apps
A summary screen view after Uploading the Spinners image we obtained from Loading.io into the Power Apps

Overlay Functionality

Also, introducing a label with a Fill property of RGBA(0,0,0,0.1) acts as an overlay, inhibiting other user actions.

Insert a label with the Fill property set to RGBA(0,0,0,0.1) to cover the entire screen in Power Apps

Utilize the showSpinner_var variable in the Visible property of both the loading spinner and the label. This variable will control their visibility based on the loading status.

Utilizing the showSpinner_var variable in the Visible property of both the spinner

Now, when the user clicks on a gallery item, the loading spinner will be displayed until the form appears. It’s as
simple as that!

When the user clicks on a gallery item, the Power Apps Loading Spinners will be displayed until the form appears

The Art and Magic of Saving Spinners:

Saving spinners play a pivotal role during data saving processes. By tweaking the OnSelect property of the Submit button and the OnSuccess property of the form, the spinner’s appearance adjusts based on the data-saving status.

Effective Positioning

Centering the spinner image on the form, coupled with a white label overlay, magnifies user engagement. Additionally, a label with RGBA(0,0,0,0.1) augments the display.

Displaying while a form is in the process of saving data
  • Insert this code in the OnSelect property of the Submit button to activate the saving spinner. 
				
					UpdateContext({showspinner2_var:true}); 

SubmitForm(Form1_1) 
				
			
Displaying while a form is in the process of saving data
  • Now, write this code in the OnSuccess property of the form. This will ensure that the saving spinner disappears once the form data has been successfully saved. 
				
					UpdateContext({showspinner2_var:false}) 
				
			
Ensure that the PowerApps saving spinner disappears once the form data has been successfully saved through code in PowerApps
  • Duplicate the spinner image and place it at the center of the form. 
Duplicating the Spinners image and placing it at the center of the PowerApps view

Next, generate a label with a white Fill property and position it directly over the form. 

Generating a label with a white Fill property and position it directly over the form in Power Apps

Once more, add a label with the Fill property set to RGBA(0,0,0,0.1) to cover the entire screen. This label will serve as an overlay. 

Adding another label which will serve as an overlay in Power Apps Loading Spinners

Include the showspinner2_var variable within the Visible property of all three controls. This variable will determine their visibility based on the spinner status. 

				
					showspinner2_var 
				
			
Variable determining their visibility based on the Power Apps Loading Spinners status.
  • Now, a spinner will be displayed until the form has completed writing data back to the data source. 

Progress Bars: Beyond Spinners

For extended data operations, the indispensability of a progress bar becomes evident. It provides real-time feedback, ensuring users that the app remains active.

Setting Up for Progress Bars

Starting with the “Admin Screen”, a toggle named “Admin_tog” is pivotal. As you proceed to the “Loading Data” screen, codes in various properties automate processes, update metrics, and ensure user-friendly interfaces.

Crafting the Perfect Progress Bar

This involves introducing labels, adjusting colors, and employing codes for dynamic updates. Ultimately, you have a responsive progress bar that modifies itself as data is processed.

Placing a toggle named tog_AdminMode and switch it on in PowerApps Screen for Power Apps Loading Spinners

Create another new screen and name it “Loading Data.” On this screen, insert a button labeled “Load_Data_button 

Create another new screen and name it Loading Data in PowerApps for Power Apps Loading Spinners

Upon reaching the Loading Screen, the button will automatically activate. Place this code in the OnVisible property of the Loading Screen. 

				
					If(Admin_tog,Select(Load_Data_button)) 
				
			

Next, apply this code to the OnSelect property of the button. This pattern involves updating two variables before loading each table: locLoadingMessage, which displays a message on the screen, and locLoadingPercent, which incrementally widens the progress bar. Predicting the precise completion percentage is often challenging, so it’s typically necessary to make an estimate and set these values manually.

				
					
// Update loading message and set progress to 20% while loading Table 1 (Employees)
UpdateContext({
   Loading_msg: "Loading Table 1...",
   Loading_percent: 0.2
});
ClearCollect(Col_table1, Employees);
// Update loading message and set progress to 40% while loading Table 2 (Paid Time-Off)
UpdateContext({
    Loading_msg: "Loading Table 2...",
    Loading_percent: 0.4
});
ClearCollect(Col_table2, 'Paid Time-Off');
// Update loading message and set progress to 65% while loading Table 3 (Running Totals)
UpdateContext({
    Loading_msg: "Loading Table 3...",
    Loading_percent: 0.65
});
ClearCollect(Col_table3, 'Running Totals');
// Update loading message and set progress to 90% while loading Table 4 (ProductList)
UpdateContext({
    Loading_msg: "Loading Table 4...",
    Loading_percent: 0.90
});
ClearCollect(Col_table4, ProductList);
// Update loading message to indicate loading is complete and set progress to 100%
UpdateContext({
    Loading_msg: "Loading Complete",
    Loading_percent: 1.0
});
// Navigate to the 'DataEntryScreen' with a cover screen transition
Navigate(DataEntryScreen, ScreenTransition.Cover)
				
			

To conceal the button when our app is not in Admin Mode, utilize this code in the Visible property of the button.

				
					Admin_tog
				
			

Now, let’s craft the progress bar. Add a slim rectangle-shaped label to the screen, modify the fill color to dark gray, and position it at the center of the screen. 

Adding a slim rectangle-shaped label to the screen in PowerApps for Power Apps Loading Spinners

Duplicate the dark gray label, naming it “rect_Progress_Bar” and adjust its Fill property to blue. 

Customization duplicating the dark gray label in PowerApps for Power Apps Loading Spinners

To expand the size of the progress bar as data loads into the collection, utilize this code in the Width property of the “rect_Progress_Bar 

				
					rect_Progress_Bar.Width*Loading_percent
				
			
Utilize the code To expand the size of the progress bar as data loads into the collection on width in PowerApps for Power Apps Loading Spinners

Create another label and position it above the progress bar to display the current status. 

Creating another label and position it above the progress bar in PowerApps for Power Apps Loading Spinners

Place the locLoadingMessage label within the Text property of the label positioned above the progress bar. 

				
					 Loading_msg 
				
			
Customizing the label positioned above the progress bar for Power Apps Loading Spinners

The progress bar now expands as data is loaded, keeping the user informed about the app’s ongoing processes.

A Final view as the progress bar now expands as data is loaded in PowerApps as a Power Apps Loading Spinners

Usage Insights and Best Practices:

Power Apps remains an anchor for countless organizations, hence optimization is paramount. Current design trends lean towards minimalist spinners. Thus, clarity becomes indispensable. Regular feedback further hones user satisfaction.

Conclusion:

In essence, loading spinners and progress bars transcend mere aesthetics. They offer instantaneous feedback, ensuring users remain engaged, even during potential waits. Adhering to the steps delineated above empowers developers to fashion a frictionless interface that curtails operational snags.

If you want to learn more about the Power Apps, feel free to explore our other informative articles and tutorials.

Have additional inquiries? Our team is here to assist. Please don’t hesitate to reach out!

About The Author