SOLVED

Simple Power App using a Collection

Iron Contributor

Thought I'd try to build a simple app to store data to a "Collection" and used Shane @ Bold Zebras video on YouTube at https://www.youtube.com/watch?v=yS6mTRlmuls as a guide. Followed to the letter (or so I thought) and having built an app, data entered in to the app appears in the Collection list when I view it. At least it does until I exit and come back when I find my data has gone. First discovered this when I used the app on my mobile, produced a list which remains whilst the app is open but as soon as the app is closed the data disappears. Anyone any idea where I went wrong please or are collections not meant to be used for actually storing data beyond the session you're on. Hopefully there's a way to store the data and be able to close/reopen the app on my phone but cant see any obvious answer. Any experts out there (I'm novice so anyone that knows more than me is an expert :) know where I screwed up.

 

I'm only storing one piece of data "item" and this is the command I've used:

Collect(ItemsStored,{Name:I_Item.Text})

 

Saving grace for now is that I've added the ability to email the list to myself so I can at least use the app for now but ideally would like to store properly if anyone can help.

 

Thanks

4 Replies
best response confirmed by Allan Clarke (Iron Contributor)
Solution

Hi @Allan Clarke,

As you mention: A collection is not meant to save data beyond the session you're on, but is a temporary data set you can use during the session. So every time you open the app the collection starts all over.

Data added to the collection during the use of the app will remain there until you remove it from the collection or close the app.

You can repopulate a collection using a formula on start of an app, but that will just populate it with exactly the same data every time you start it.

If you want to save data beyond the session of an app you will need to connect a data source. That could be an Excel on your OneDrive, a list in SharePoint, a SQL database or Dynamics CE, you name it.

Thanks for confirming what I suspected. Will have to go back to the drawing board.
In the mean time I learned something myself. You can use the SaveData/LoadData functions to store collected data locally on a device for reuse beyond the current session of the app. It only works in combination with the PowerApps app, so not in the browser. And only on the device where the data is stored.

More information about these functions in this article: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-savedata-loaddata

Nice one, thanks for the heads up.

1 best response

Accepted Solutions
best response confirmed by Allan Clarke (Iron Contributor)
Solution

Hi @Allan Clarke,

As you mention: A collection is not meant to save data beyond the session you're on, but is a temporary data set you can use during the session. So every time you open the app the collection starts all over.

Data added to the collection during the use of the app will remain there until you remove it from the collection or close the app.

You can repopulate a collection using a formula on start of an app, but that will just populate it with exactly the same data every time you start it.

If you want to save data beyond the session of an app you will need to connect a data source. That could be an Excel on your OneDrive, a list in SharePoint, a SQL database or Dynamics CE, you name it.

View solution in original post