Build a Loading Screen with Progress Messages in Power Apps

Share
Build a Loading Screen with Progress Messages in Power Apps

A loading screen that says what it is doing feels faster than one that only spins. Tie a percentage and a message to one variable, DataLoadStatus, update it as each data source finishes loading, and the screen reports real progress.

This post builds it with one HtmlText control, four step segments that turn from gray to coral to teal as loading moves along, and a hidden timer that moves on when loading is done.

How it works

Three pieces do all the work:

  1. A status record. DataLoadStatus holds a Percentage from 0 to 100 and a Message that names the step in progress.
  2. One HtmlText control. It draws a big percentage, a title, the message and four step segments from that record, so the screen redraws on its own every time the record changes.
  3. A hidden timer. It checks every second whether the percentage has reached 100 and then navigates.

The loading screen loads your data one source at a time and updates the record as it goes. Once the percentage reaches 100, the timer sends the user to the first real screen, or to a deep-linked one.

The percentages are real: they come from your data loads, not from a timer pretending to work.

See it work

Press Replay to watch the percentage climb, the message change and each step turn from gray to coral to teal, then switch to the Code tab for the HtmlText formula. The animation here only simulates the loading. In Power Apps the record comes from your data loads.

Build it in Power Apps

1. Create the status record

Progress lives in one global variable, a record with two fields. You create it the first time you set it:

Set(DataLoadStatus, {Percentage: 0, Message: "Loading settings..."})

Because the message is part of the record, there is no lookup table to keep in sync. Each step says what it is doing as it starts.

2. Load the data in steps

Create a loading screen and make it the first screen in the app. In its OnVisible, set the record before each source loads, so the percentage is the share already finished and the message names the step now running:

Set(DataLoadStatus, {Percentage: 0, Message: "Loading settings..."});
ClearCollect(colSettings, Settings);

Set(DataLoadStatus, {Percentage: 25, Message: "Connecting to accounts..."});
ClearCollect(colAccounts, Accounts);

Set(DataLoadStatus, {Percentage: 50, Message: "Loading records..."});
ClearCollect(colRecords, Records);

Set(DataLoadStatus, {Percentage: 75, Message: "Building reports..."});
ClearCollect(colReports, Reports);

Set(DataLoadStatus, {Percentage: 100, Message: "All done"})

Replace the collection names, data sources and messages with your own. Starting at 0 means the screen resets cleanly if the user ever returns to it. There is no Navigate here: the timer in step 4 does that.

The quarter steps are only an example. Give a large source a bigger share of the bar, for instance 10, 20 and 70, so the bar moves at the pace people actually wait.

3. Draw it with one HtmlText control

Add an HtmlText control, size it 800 wide by 400 high and center it on the screen, then paste in the formula from the Code tab above. It reads DataLoadStatus and a Logo variable, so it redraws each time the record changes.

Every size in the formula comes from one unit, u, the smaller of the control's height and 29% of its width. Change the control's size and the whole layout scales with it. Logo is an SVG stored as text with a black (#000000) fill, which the formula recolors. It also swaps apostrophes for %27, because EncodeUrl leaves them alone and they would end the single-quoted src.

The colors are plain hex values in the p record at the top. If you built a theme with the Theme Studio, swap them for ColorToHex(AppTheme.AccentColor) and the other tokens, and the loading screen follows your theme.

4. Navigate with a timer

Add a Timer control and set Duration to 1000, Repeat to true, AutoStart to true and Visible to false. In its OnTimerEnd:

If(
    DataLoadStatus.Percentage = 100,
    Navigate(
        If(
            Param("Source") = "Details", DetailsScreen,
            HomeScreen
        ),
        ScreenTransition.Fade
    )
)

Param("Source") reads a deep link such as ?Source=Details, so a link can land on a specific screen once loading is done. Add more branches as you need them and keep the default screen last. The one-second check also lets the 100% and the final message show for a moment before the app moves on.

Common mistakes

  • The bar jumps from 0 to 100: the record is only set at the end, or the loads are wrapped in Concurrent(). Concurrent runs them in parallel, so there is no "first" and "second" to report. Load in sequence when you want progress.
  • The screen stays blank until loading finishes: the loads are in App.OnStart. Move them to the loading screen's OnVisible.
  • The app never leaves the loading screen: the timer's Repeat or AutoStart is off, or the last step never sets Percentage to exactly 100.
  • The logo is missing or the whole screen breaks: apostrophes in the SVG ended the src. Keep the Substitute(..., "'", "%27") step, and make sure the SVG uses #000000 if you want it recolored.
  • The percentage shows decimals: wrap it in Round(pct, 0), as the formula does.
  • The bar gets stuck partway: one load failed and the formula stopped. Wrap that load in IfError(...) and show a message, so the screen doesn't hang silently.

Recap

  1. Keep one record, DataLoadStatus, with a Percentage from 0 to 100 and a Message.
  2. In the loading screen's OnVisible, set the record before each source loads, one source at a time.
  3. Draw the percentage, message and step segments in one HtmlText control, sized from a single unit u.
  4. Add a hidden repeating Timer that navigates when the percentage reaches 100, with an optional Param("Source") deep link.