SaveData, LoadData, and ClearData functions - Power Platform (2024)

  • Article

Applies to: SaveData, LoadData, and ClearData functions - Power Platform (1) Canvas apps

Saves and reloads a collection from the app host's storage.

Note

These functions can now be used when playing an app in a web browser as an experimental feature. This feature is disabled by default. To enable, navigate to Settings > Upcoming features > Experimental > Enabled SaveData, LoadData, ClearData on web player." and turn the switch on. To submit feedback regarding this experimental feature, go to Power Apps community forum.

Description

The SaveData function stores a collection for later use under a name.

The LoadData function reloads a collection by name that was previously saved with SaveData. You can't use this function to load a collection from another source.

The ClearData function clears the storage under a specific name or clears all storage associated with the app if no name is provided.

Note

  • The name shared between SaveData, LoadData, and ClearData is a key, not a file name. It need not be complex as names are unique to each app and there is no danger of name conflict. The name must not contain any of these characters: *".?:\<>|/.
  • SaveData is limited to 1 MB of data for Power Apps running in Teams and in a web browser. There is no fixed limit for Power Apps running in a mobile player but there are practical limits discussed below.
  • Don't use SaveData to store sensitive data in the web since it'll be stored in plain text.

Use these functions to improve app-startup performance by:

  • Caching data in the App.OnStart formula on a first run.
  • Reloading the local cache on next runs.

You can also use these functions to add simple offline capabilities to your app.

You can't use these functions inside a browser when:

  • Authoring the app in Power Apps Studio.

To test your app, run it in Power Apps Mobile on an iPhone or Android device.

These functions are limited by the amount of available app memory as they operate on an in-memory collection. Available memory can vary depending on factors such as:

  • The device and operating system.
  • The memory that the Power Apps player uses.
  • Complexity of the app with screens and controls.

Test your app with expected scenarios on the type of devices you expect the app to run when storing large data. Expect to have between 30 MB and 70 MB of available memory generally.

These functions depend on the collection being implicitly defined with Collect or ClearCollect. You don't need to call Collect or ClearCollect to load data into the collection for defining it. It's a common case when using LoadData after a previous SaveData. All that is needed is the presence of these functions in a formula to implicitly define the structure of the collection. For more information, see creating and removing variables.

The loaded data will be appended to the collection. Use the Clear function before calling LoadData if you want to start with an empty collection.

Data security

Consider carefully the isolation and encryption of data stored with SaveData and decide if it's appropriate for your needs, especially if devices are shared by multiple users.

Data stored with SaveData is isolated from other Power Apps by the Power Apps players. Data is stored based on the app's App ID, automatically isolating the SaveData name space between Power Apps.

The operating system and browser is responsible for isolating data between Power Apps and other apps on a device and with websites. For example, the operating system is responsible for isolating data stored in Microsoft Outlook from data stored in Power Apps, and also isolating that data from websites such as Bing.com or PowerApps.com. The operating system's built in app sandbox facilities are used for SaveData storage which is usually not accessible to or hidden from the user.

When using the same app, the operating system and browser is also responsible for isolating the data between different operating system level users. For example, if two different users share a computer and use two different Windows login credentials, the operating system is responsible for isolating data between the two Windows users.

Data may or may not be isolated between different Power Apps users if the operating system user is the same. Not every Power Apps player treats this the same way. For example, while logged in as the same Windows user, in the Power Apps player, the user signs out of Power Apps and signs in as a different Power Apps user. Data stored in an app before the change of Power Apps user, may be accessible to the second Power Apps user within the same app. The data may also be removed and the first Power Apps user may no longer be able to access it. The behavior varies between Power Apps players.

The operating system may also encrypt the data or you can use a mobile device management tool such as Microsoft Intune. Data stored when playing an app in a web browser is not encrypted.

Syntax

SaveData( Collection, Name )
LoadData( Collection, Name [, IgnoreNonexistentFile ])

  • Collection - Required. Collection to be stored or loaded.
  • Name - Required. Name of the storage. The name must be same to save and load same set of data. The name space isn't shared with other apps. Names must not contain any of these characters: *".?:\<>|/.
  • IgnoreNonexistentFile - Optional. A Boolean value indicating what to do if the file doesn't already exist. Use false (default) to return an error and true to suppress the error.

ClearData( [Name] )

  • Name - Optional. Name of the storage previously saved with SaveData. If Name is not provided, all storage associated with the app is cleared.

Examples

FormulaDescriptionResult
SaveData( LocalCache, "MyCache" )Save the LocalCache collection to the user's device under the name "MyCache", suitable for LoadData to retrieve later.Data is saved to the app host under the name "MyCache".
LoadData( LocalCache, "MyCache" )Loads the LocalCache collection from the user's device under the name "MyCache", previously stored with a call to SaveData.Data is loaded from the app host under the name "MyCache".
ClearData( "MyCache" )Clears the storage under the name "MyCache". Any data stored under this name will no longer be available through LoadData.Data is removed from the app host under the name "MyCache".
ClearData()Clear all storage associated with this app. Data stored by other apps is not affected.All data is removed from the app host.

Simple offline example

Following simple example captures and stores the names and pictures of everyday items while offline. It stores the information in the device's local storage for later use. This allows the app to be closed or the device to restart without losing data.

Note

This example uses a camera control to capture images. Since SaveData is limited to 1 MB of data when running in Teams or a web browser, this example will not work with more than a few images. Also, depending on the camera, it may not work with even one image. Use a device to work through this full example, or remove the camera control and picture part of this example to run in Teams or in a web browser.

  1. Create a blank canvas app with a tablet layout. For more details, read creating an app from a template and select Tablet layout under Blank app.

  2. Add a Text input control and a Camera control and arrange them roughly as shown:

    SaveData, LoadData, and ClearData functions - Power Platform (2)

  3. Add a Button control.

  4. Double-click the button control to change the button text to Add Item (or modify the Text property).

  5. Set the OnSelect property of the button control to this formula that will add an item to our collection:

    Collect( MyItems, { Item: TextInput1.Text, Picture: Camera1.Photo } )

    SaveData, LoadData, and ClearData functions - Power Platform (3)

  6. Add another Button control.

  7. Double-click the button control to change the button text to Save Data (or modify the Text property).

  8. Set the OnSelect property of the button control to this formula in order to save our collection to the local device:

    SaveData( MyItems, "LocalSavedItems" )

    SaveData, LoadData, and ClearData functions - Power Platform (4)

    It's tempting to test the button as it doesn't affect anything. But you'll only see an error as you're authoring in a web browser. Save the app first and open on a device before you follow the next steps to test this formula:

  9. Add a third Button control.

  10. Double-click the button control to change the button text to Load Data (or modify the Text property).

  11. Set the OnSelect property of the button control to this formula in order to load our collection from the local device:

    LoadData( MyItems, "LocalSavedItems" )

    SaveData, LoadData, and ClearData functions - Power Platform (5)

  12. Add a Gallery control with a Vertical layout that includes a picture and text areas:

    SaveData, LoadData, and ClearData functions - Power Platform (6)

  13. When prompted, select the MyItems collection as the data source for this gallery. This will set the Items property of the Gallery control:

    SaveData, LoadData, and ClearData functions - Power Platform (7)The image control in the gallery template should default its Image property to ThisItem.Picture and the label controls should both default their Text properties to ThisItem.Item. Check these formulas if after adding items in the following steps you don't see anything in the gallery.

  14. Position the control to the right of the other controls:

    SaveData, LoadData, and ClearData functions - Power Platform (8)

  15. Save your app. If it's the first time it has been saved, there's no need to publish it. If it's not the first time, publish the app after you save.

  16. Open your app on a device such as a phone or tablet. SaveData and LoadData can't be used in Studio or in a web browser. Refresh your app list if you don't see your app immediately, it can take a few seconds for the app to appear on your device. Signing out and back in to your account can help too.

    SaveData, LoadData, and ClearData functions - Power Platform (9)Once your app has been downloaded, you can disconnect from the network and run the app offline.

  17. Enter the name and take a picture of an item.

  18. Select the Add Item button. Repeat adding items a couple of times to load up your collection.

    SaveData, LoadData, and ClearData functions - Power Platform (10)

  19. Select the Save Data button. This will save the data in your collection to your local device.

  20. Close the app. Your collection in memory will be lost including all item names and pictures, but they'll still be there in the device's storage.

  21. Launch the app again. The collection in memory will again show as empty in the gallery.

    SaveData, LoadData, and ClearData functions - Power Platform (11)

  22. Select the Load Data button. The collection will be repopulated from the stored data on your device and your items will be back in the gallery. The collection was empty before this button calls the LoadData function; there was no need to call Collect or ClearCollect before loading the data from storage.

    SaveData, LoadData, and ClearData functions - Power Platform (12)

  23. Select the Load Data button again. The stored data will be appended to the end of the collection and a scroll bar will appear on the gallery. If you would like to replace rather than append, use the Clear function first to clear out the collection before calling the LoadData function.

    SaveData, LoadData, and ClearData functions - Power Platform (13)

More advanced offline example

For a detailed example, see the article on simple offline capabilities.

SaveData, LoadData, and ClearData functions - Power Platform (2024)

FAQs

Where does the SaveData and LoadData function work? ›

These functions can now be used when playing an app in a web browser as an experimental feature. This feature is disabled by default. To enable, navigate to Settings > Upcoming features > Experimental > Enabled SaveData, LoadData, ClearData on web player." and turn the switch on.

How do you clear form data in power apps? ›

Clear Field

So, every form field value is stored in a data card value field. On the right hand properties, look for Clear Field option from the list of Text Input properties. Notice that a X appears on the field when in focus/active. So when you make a mistake in a field, click on it to clear that field.

Where does PowerApps save data? ›

Data sources for PowerApps are stored in the cloud, or locally stored in a specific app. The most common form of data sources used for PowerApps are tables. By connecting to cloud and local data sources, you can read, amend, and reformat tables across all of your apps, with total ease and control.

What is the function of Save tool? ›

Save allows us to update the previously saved version to match the current working version, and the previous stored work to be updated with the new work. Save As allows us to save our work for the first time, as well as ask for the name and location where it will be saved.

How do I clear application data? ›

Here's how to clear app data on Android devices: Open Settings and select Apps. Tap on the app you want to clear app data for, then select Storage followed by Clear data.

What is the reset function in power apps? ›

The Reset function resets a control to its Default property value. Any user changes are discarded. You cannot reset controls that are within a Gallery or Edit form control from outside those controls. You can reset controls from formulas on controls within the same gallery or form.

What is the button to clear form data? ›

To reset all field values in an HTML form, you can use the <input type=”reset”> attribute. When the reset button is clicked, the form will be restored to its default state, without any of the values that were previously entered in the fields, checkboxes, or radio buttons.

Why use Dataverse instead of SQL? ›

Because Microsoft Dataverse is more than just a database. As opposed to SQL, Dataverse also includes a business application layer. It includes a set of features that are usually found in applications, or systems.

Why use Dataverse instead of Excel? ›

Pros: Integration and Scalability: Dataverse excels in its seamless integration with the Power Platform and Dynamics 365, making it a robust solution for large-scale enterprise applications. Its cloud-based nature allows for superior scalability and accessibility.

Which database is best for PowerApps? ›

Top Data Sources for Power Apps
  • Microsoft Dataverse: The Preferred Choice. ...
  • SQL Server and Azure SQL Database: For Complex Data Needs. ...
  • SharePoint Lists.
  • Custom Data Sources. ...
  • Microsoft Excel. ...
  • Cost Savings. ...
  • Effective Setup and Optimisation. ...
  • Tailored Solutions for Business Goals.
Oct 12, 2023

Where is save data stored on Windows? ›

Microsoft Store Game Save File on Windows 10

The saved files from any Microsoft Store games will be in App Data's subfolder called LocalLow. That means you will have to access the hidden App Data folder once more.

Where is HoloCure save data located? ›

Navigate to Users\[your username]\AppData\Local\HoloCure as shown below: Look for save_n. dat. If you start getting achievement pop-ups for everything you did on your previous save, then CONGRATS you don't have to do anything else!

Where are control saves stored? ›

Save game data location
SystemLocation
GOG.com%LOCALAPPDATA% \Remedy\Control\Default-Generic-User\ %USERPROFILE% \ Documents \My Games\Control\Saves\
Microsoft Store%LOCALAPPDATA% \Packages\505GAMESS.P.A.ControlPCGP_tefn33qh9azfc\SystemAppData\wgs\
Steam<Steam-folder> \userdata\ <user-id> \870780\remote\
2 more rows
May 18, 2024

Top Articles
How much gold should I own?
What is the Golden Ratio of Facial Aesthetics? - Maningas Cosmetic Surgery
Katie Pavlich Bikini Photos
Gamevault Agent
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Free Atm For Emerald Card Near Me
Craigslist Mexico Cancun
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Doby's Funeral Home Obituaries
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Select Truck Greensboro
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Craigslist In Flagstaff
Shasta County Most Wanted 2022
Energy Healing Conference Utah
Testberichte zu E-Bikes & Fahrrädern von PROPHETE.
Aaa Saugus Ma Appointment
Geometry Review Quiz 5 Answer Key
Walgreens Alma School And Dynamite
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Dmv In Anoka
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Pixel Combat Unblocked
Umn Biology
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Rogold Extension
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Weekly Math Review Q4 3
Facebook Marketplace Marrero La
Nobodyhome.tv Reddit
Topos De Bolos Engraçados
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hampton In And Suites Near Me
Stoughton Commuter Rail Schedule
Bedbathandbeyond Flemington Nj
Free Carnival-themed Google Slides & PowerPoint templates
Otter Bustr
Selly Medaline
Latest Posts
Article information

Author: Fr. Dewey Fisher

Last Updated:

Views: 5824

Rating: 4.1 / 5 (62 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Fr. Dewey Fisher

Birthday: 1993-03-26

Address: 917 Hyun Views, Rogahnmouth, KY 91013-8827

Phone: +5938540192553

Job: Administration Developer

Hobby: Embroidery, Horseback riding, Juggling, Urban exploration, Skiing, Cycling, Handball

Introduction: My name is Fr. Dewey Fisher, I am a powerful, open, faithful, combative, spotless, faithful, fair person who loves writing and wants to share my knowledge and understanding with you.