Is there a way to temporarily store State data? For instance, I have a simple app like this:
It is under a tab in a request form. If I want to save this cart and come back to it.. do I have to write it into a table? Or can I just store this data until I am ready to submit it?
Try using the SaveData, LoadData, and ClearData functions in PowerApps
and see if it works for you.
The data should not be too big:
- 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...
- Don't use SaveData to store sensitive data in the web since it'll be stored in plain text.
however, depending on your use case, it may help you to use these functions (in some particular cases, like yours with the cart, depending on the scenario and how big the data is you want to store) rather than writing to a data source.
NOTE: For anyone using their web browser to play the app, you must have the Settings -> Upcoming Features -> Preview -> Enable SaveData, LoadData, ClearData on web player toggled to On . Note that as of this writing, this defaults to Off and must be set to On if you want to use it!
1. Click on Settings
2. Click Upcoming Features
3. Click on Enable SaveData, LoadData, ClearData on web player to toggle it on On if you notice that it is Off
4. Just close this modal window, the setting should update right when you have made the changes.
5. Save and Publish your app to make these changes take effect.
6. I don't believe this particular setting requires you to close and open the Power Apps Editor. In case you have any issue, you can try that too, but I believe this setting does not need that. Make sure to Save and Publish your app first before trying this though!
See if it helps @ChannelDevMike
Do you know how to keep track of it in developer chrome settings?
I don't see the name I gave it in local storage, but I don't know if it'll be naming things differently as well
I tested it in some more detail, here are my findings in case it helps you:
1. Even if the feature for Web Player is on, Errors might continue to show in the Power Apps formula bar in the Editor when triggering the SaveData function directly in the Editor or in Editor Preview mode. Note that upon testing this, re-opening the Power Apps editor should not cause any of these Editor errors to go away. So it is not necessary to do so. Also, the place where I saw the actual storage elements come in, do not come in in the Editor no matter how many times I reopened the Editor. They also didn't show up when I enabled other features at the same time, closed, and reopened the editor. That means it may also not be possible to test these functions at all in the Editor, only in the Live, published app.
2. I checked in the Live, published app. The elements don't appear to be stored in LocalStorage, but in IndexedDB. In your screenshot, click to expand IndexedDB rather than LocalStorage. Now look for the really long guid looking string starting with a slash / , and expand that too.
Now click keyvaluepairs.
You should see your SaveData elements come in here.
3. No matter what I try, the IndexedDB elements shown in #2 are not possible to be made to show in #1. So I suspect the feature is not supported at all in the Editor, and that the setting I described before, even when enabled, only works in the Live, published app.
See if it helps @ChannelDevMike
Hmm yes, it does seem to work in the live setting... great to know for future but doesn't look like it'll do what I want overall.
As you can see, its saving within the model-driven app portion. This long string isnt dependent on each request like I had hoped. So each request will show the same cart when the canvas tab is clicked.
Do you know of any other method to temporarily keep cart data based on the parent (Request)?
Btw you have been extremely helpful! Its been much appreciated !
Keep up to date with current events and community announcements in the Power Apps community.
A great place where you can stay up to date with community calls and interact with the speakers.
Check out the latest Community Blog from the community!