- Article
- 9 minutes to read
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
Formula | Description | Result |
---|---|---|
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.
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.
Add a Text input control and a Camera control and arrange them roughly as shown:
Add a Button control.
Double-click the button control to change the button text to Add Item (or modify the Text property).
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 } )
Add another Button control.
(Video) PowerApps Offline ModeDouble-click the button control to change the button text to Save Data (or modify the Text property).
Set the OnSelect property of the button control to this formula in order to save our collection to the local device:
SaveData( MyItems, "LocalSavedItems" )
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:
Add a third Button control.
Double-click the button control to change the button text to Load Data (or modify the Text property).
Set the OnSelect property of the button control to this formula in order to load our collection from the local device:
LoadData( MyItems, "LocalSavedItems" )
Add a Gallery control with a Vertical layout that includes a picture and text areas:
When prompted, select the MyItems collection as the data source for this gallery. This will set the Items property of the Gallery control:
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.
Position the control to the right of the other controls:
(Video) CRUD Operation in PowerApps | Add, Edit, Update, Delete data PowerApps - PowerApps Tutorial | CRUDSave 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.
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.
Once your app has been downloaded, you can disconnect from the network and run the app offline.
Enter the name and take a picture of an item.
Select the Add Item button. Repeat adding items a couple of times to load up your collection.
Select the Save Data button. This will save the data in your collection to your local device.
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.
Launch the app again. The collection in memory will again show as empty in the gallery.
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.
(Video) PowerApps Offline ModeSelect 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.
More advanced offline example
For a detailed example, see the article on simple offline capabilities.
FAQs
Where does Power Apps 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 are the different functions in Power Apps? ›Substitute – Replaces part of a string with another string, by matching strings. SubmitForm – Saves the item in a form control to the data source. Sum – Calculates the sum of a table expression or a set of arguments. Switch – Matches with a set of values and then evaluates a corresponding formula.
How do I load data into power app? ›- On powerapps.com, expand the Data section. ...
- Select Data, to the right of Get Data select >, and then select Get data from Excel.
- Select the tables where you want to import data, and then select Next.
- On the Import data page, select Upload, and choose your file.
The Filter function finds records in a table that satisfy a formula. Use Filter to find a set of records that match one or more criteria and to discard those that don't.
How do I delete data from PowerApps? ›Clearing control values, setting control value to blank
To clear a data entry control on an edit screen, the strategy is to set the default value of the control based on the value of a Boolean variable. If the variable is true, we set the default value to blank or empty value.
In this article we are going to learn about creating Canvas App in PowerApp. On the first screen you can see there are 3 options: Canvas App, Model Driven and Portal.
What are the two types of Power Apps? ›There are two main types of Power Apps: Canvas apps and Model-driven apps. Previously, Power Apps Portals would have fallen under this category. Microsoft have since released Power Pages, a standalone product that has evolved from the functionality of Power Apps Portals.
What is a dataflow in Power Apps? ›A dataflow is a collection of tables that are created and managed in environments in the Power Apps service. You can add and edit tables in your dataflow, as well as manage data refresh schedules, directly from the environment in which your dataflow was created.
How do I add data to a Dataverse table? ›- Sign in to Power Apps.
- In the navigation pane, select Dataverse to expand it, and then select Tables.
- In the command menu, select Data > Get data.
- In the list of data sources, select OData.
- In the list of tables, select the Customers check box, and then select Next.
- Step 1 - Format your data as a table in Excel. Ensure that the Excel data you want to use in Power Apps is formatted as a table in Excel.
- Step 2 - Store your Excel file in a cloud location. ...
- Step 3 - Add Excel as a data source for your Power App.
How do you handle more than 2000 records in Power Apps? ›
4) Collecting records in PowerApps
But how do we collect more than 2000 records in a single collection? The answer is you need to collect data in different collections and than merge all your collections into a single collection.
Power Apps collections are limited to a size of 2,000 records unless you know the special techniques needed to go past that number. This is because the ClearCollect and Collect functions can only return as many records as the delegation limit allows.
What are the two types of data sources that power platform connectors provide access to? ›Connectors allows your app to connect to underlying data sources. There are two types of data-sources: Tabular and action-based.
What is the purpose of using the SaveData () function? ›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.
What is clear in Powerapps? ›The Clear function deletes all the records of a collection. The columns of the collection will remain. Note that Clear only operates on collections and not other data sources. You can use RemoveIf( DataSource, true ) for this purpose.
How do I clear my data? ›- On your Android phone or tablet, open the Chrome app .
- Tap More. Settings.
- Tap Privacy and security. Clear browsing data.
- Choose a time range, like Last hour or All time.
- Select the types of information you want to remove.
- Tap Clear data.
Power platform has 4 primary components - Power BI, Power Apps, Power Automate and Power Virtual Agents. The other components that are often used with Power Platform are - Dataflex Pro (Common Data Services), AI Builder, and UI Flow (part of Automate).
How many types of variables are there in PowerApps? ›Variables are created and typed by default when they are displayed in the functions which define their values. Three types of Variables are available in PowerApps.
What are the different ways to submit data from PowerApps? ›- SubmitForm. Use the SubmitForm function in the OnSelect property of a Button control to save any changes in a Form control to the data source. ...
- EditForm. The EditForm function changes the Form control's mode to FormMode. ...
- NewForm. ...
- ResetForm. ...
- ViewForm. ...
- DisplayMode Property.
There are four environment types that you can create from the admin center + the community plan or what we call the personnel environment. By default, the environment creation is for everyone unless the admin restricts the environment creation for only specific admins.
What are the connectors in Power Apps? ›
A connector is a proxy or a wrapper around an API that allows the underlying service to talk to Microsoft Power Automate, Microsoft Power Apps, and Azure Logic Apps. It provides a way for users to connect their accounts and leverage a set of prebuilt actions and triggers to build their apps and workflows.
What are tables in Power Apps? ›A table is a value in Power Apps, just like a string or a number. You can specify a table as an argument for a function, and functions can return a table as a result. Table doesn't create a permanent table. Instead it returns a temporary table made of its arguments.
What is the difference between Power Apps and power platform? ›The PowerApps is an application development platform that is part of the broader Microsoft Power Platform, whose capabilities are built on and utilize Azure cloud services. Dynamics 365 for Sales, Service, Field Service, Marketing, and Talent are all built natively on the platform.
What is PCF control in Power Apps? ›A PCF (PowerApps component framework) control enables professional developers and app makers to create code components for model-driven apps and canvas apps. This helps provide an improved experience for users working with data in forms, views, and dashboards. You can read more about this here.
What is the difference between canvas app and model driven app in Power Apps? ›That level of integration with the Dataverse means Model-Driven Apps can be described as 'data-first'. They're far more rigid in their functionality than a Canvas App will be, with the UI (User Interface) components likely being selected from pre-made choices (although some customisation is still possible).
Can Power Apps be used for data entry? ›Power Apps makes building data entry forms surprisingly simple – just insert a new form onto the screen, watch all of the fields in your data source magically appear in the form, then add a 'submit' button and you're done. But forms also have many feature experienced makers must know to use them effectively.
What is the difference between dataflow and dataset? ›So, anything somehow related to the data is a part of the dataset. Dataflow: Dataflow is the data transformation component of Power BI, which is independent of any other Power BI artifacts. It is a power query process that runs in the cloud and stores the data in Azure Data Lake storage or Dataverse.
What is the difference between airflow and dataflow? ›Airflow is a platform to programmatically author, schedule, and monitor workflows. Cloud Dataflow is a fully-managed service on Google Cloud that can be used for data processing. You can write your Dataflow code and then use Airflow to schedule and monitor Dataflow job.
When should I use dataflow? ›Dataflow solves the problem of having multiple versions of the same table in different PBIX files. Using the Dataflow, you reduce the need to copy and paste your Power Query script into other files. You can re-use a table in multiple files.
How many apps can use the same table in Dataverse? ›Yes, you can use the same table on as many apps you need. Each app need a connection to this table.
How do you clear data from a Dataverse table? ›
To clean up all the records from the dataverse table (Product Sales), go to the Gear settings icon (upper top right corner) -> Select Advanced settings -> Click on the Settings dropdown and then select Data Management option -> Select Bulk Record Deletion.
How many rows can a Dataverse table have? ›With Dataverse for Teams, capacity is measured with relational, image, and file data. The 2-GB capacity provided to a team can typically store up to 1 million rows of data.
Can PowerApps replace Excel? ›The Powerapp forms is a substitute for the excel form that you have built.
Can PowerApps create an Excel file? ›That's possible. You could use the Power Apps trigger, and then add the Create file action so that you could name the file based on input from power apps.
How do you pull data into a Power Query? ›Load a query from the Queries and Connections pane
In Excel, select Data > Queries & Connections, and then select the Queries tab. In the list of queries, locate the query, right click the query, and then select Load To. The Import Data dialog box appears. Decide how you want to import the data, and then select OK.
...
Limit? What limit?
- Increase the total limit items you can fetch.
- Use static data.
- OneDrive for Business connector specifics.
- Use delegation.
- Use delegation + iterative function.
- Combine PowerApps with Flow.
- Get Distinct (Collection Name is colSample) ClearCollect( colDistinct, Distinct( colSample, CreatedDate. ) ); Output for the above command.
- Clear the collection before collect. Clear(colFinal);
- Loop through the Distinct collection and get the first item from the main collection.
...
Also you can increase this limit to be up to 2000 records.
- Open your app.
- Go to File Tab >> App settings.
- Click on Advanced Settings.
- You can set the value: “the Data row limit for non-delegable queries” to be up to 2000 records.
In PowerApps, data is stored in a data source, and you bring that data into your app by creating a connection. The connection uses a specific connector to talk to the data source. So if you choose to use a cloud storage connector as the data source, then the data is stored in cloud.
How can I improve my Power Apps performance? ›The more controls you add, the more generation time Power Apps needs. You can, in some cases, achieve the same result and have the app start faster if you use a gallery instead of individual controls. In addition, you might want to reduce the number of control types on the same screen.
How to get more than 5000 items from SharePoint list in Power Apps? ›
If you genuinely need to process more than 5000 items at a time, you'd want to call the SharePoint batch API to speed things up and even then need to create a loop with the do until action as a batch call can't have more than 1000 operations.
What are the 2 types of sources of data? ›There are two types of data sources: machine data sources and file data sources. Although both contain similar information about the source of the data, they differ in the way this information is stored. Because of these differences, they are used in somewhat different manners.
What are the two common sources of big data? ›- Machine data.
- Social data, and.
- Transactional data.
In conclusion, check out the differences between all three PowerApps Connectors in nutshell in below.
Does PowerApps have a database? ›Sign in to Power Apps. In the left pane, expand the Data section, select Tables in the left navigation pane. Select Create a database to create the database.
Where are app data stored? ›When you install an app (either from the Google Play Store or through a downloaded apk file), Android places that into the device's app folder. That's /data/app/your_package_name for most apps. Some encrypted apps use /data/app-private/your_package_name.
How do PowerApps store data in Excel? ›- Step 1 - Format your data as a table in Excel. Ensure that the Excel data you want to use in Power Apps is formatted as a table in Excel.
- Step 2 - Store your Excel file in a cloud location. ...
- Step 3 - Add Excel as a data source for your Power App.
The PowerApps editor provides an auto-save feature and you can turn this on and off via the File > Account menu item.
What are the three core concepts of PowerApps? ›In this article we are going to learn about creating Canvas App in PowerApp. On the first screen you can see there are 3 options: Canvas App, Model Driven and Portal.
What are the limitations of PowerApps? ›- Limited Customization. Unlike open-source software, Power Apps is the proprietary platform owned by the tech giant Microsoft, which simply means, it is not possible to customize the application endlessly. ...
- Not Compatible With External Systems. ...
- Runs Only on PowerApps App Player.
Can I clear app data folder? ›
The AppData folder is located at C:\users\YOURNAME, where YOURNAME is your Windows profile ID. Don't move or delete files from the AppData folder; doing so will corrupt the linked program.
What is clear app usage data in app Store? ›Clearing App Data resets the application to scratch while clearing App Cache removes all the temporarily stored files. This guide will help you on How to Clear App Data and Cache on Android!
How do I delete app storage data? ›- Open Settings.
- Tap Apps & Notifications.
- Tap App info. For Android 10 and higher, tap See all ## apps (## will be a different number for each phone)
- Tap Phone.
- Tap Storage or Storage & cache.
- Tap Clear storage.
- Tap OK to delete app data. ...
- Use the Home button or Back button to exit the Settings app.
The LoadData function reloads a collection by name that was previously saved with SaveData.
What is the difference between gallery and Data table in PowerApps? ›A data table is a control that shows the data in a tabular format; where a gallery shows a set of data that contain additional controls. Here we will discuss the difference between the Power Apps data table and gallery.
How do you bulk update records in your data source in PowerApps? ›- Create an extra label within the gallery template. Bind it to the Id column. Rename the label to IdText.
- Remove the code on the OnCheck of the checkbox control mentioned above.
- Write the following formula on the OnSelect event of the Done Button: Power Apps Copy.
Connect to REST Through the API Server
In Microsoft Power Apps, click Custom connectors. Click Create custom connector and choose Import an OpenAPI file. Name the connector, browse to the JSON file, and click Continue. Fill in the relevant General information, ensure that Base URL is of the form /api.
First, select the Canvas App from blank as the PowerApps type. Enter the name of the Application as GlobalVariable and choose the Tablet format. From the insert table, add a label, text input, and a button. Now select the button and modify the formula in OnSelect.
Can you write functions in PowerApps? ›Yes, now we can create reusable functions using Power Apps Component Library.