I need some know-how, cause I have a huge problem in making my app logically correct.
I have a gallery with collection as data source. In this gallery I created inputboxes that you can input data in. Creating new gallery item - add new input fields that can be filled (commend collect).
When user finish adding all data he patch it to Sharepoint list.
This work on paper brilliantly, but the problem is that I want users to view this data from gallery anytime they want, and also modify it.
My app is for PC also so collection is dumped each log off.
I have no idea how to show this gallery with collection after app is reloaded. It is just empty.
My users can save data 24/7 and this patching to Sharepoint is just a step, cause at the end of the data each person has to click close session that patch once more and block adding new entries.
Is there a way to reload collection with data from Sharepoint list?
Or should I delete this gallery with collection and gallery with sharepoint list?
But how will I add new tasks to this gallery. In collection I use Collect and new item just appears...
IMHO, you should use the datasource as the Items property of a gallery unless there is a good reason to use a collection. A collection exists in RAM memory but when the session ends it disappears. Moreover, if something happens before the user saves the data, they have to start it all over again. This does not happen if you patch each item to the datasource as it is entered.
I use collection cause I can use gallery in a dynamic way.
Gallery with collection as a data source has one item by default and if I click collect it add a new entry. I can delete gallery dynamically too.
It is possible to do something like that with a sharepoint list as a data source?
Yes you can. Powerapps works similar to Excel in that changes are reflected as soon as the data is entered successfully. Galleries update automatically and calculations are executed once the data changes.
This is flawed. Because my gallery starts without record inputboxes will not be visible... I need at least one record to view them.
With Collection I used Collect in onVisible and first record was added. Like here. It won't... My gallery is always empty and I can't add records.
But first you told me to drop using collection and now you send me a link to a tutorial that uses collection to do this.
@Drrickryp has given you some sound advice and can only respond to your requirements as you relate them in the particular comment. I will give you another idea here, but it is syntax/structure guidance and you will need to understand the concept to implement it.
Firstly, do this at App OnStart
Then create a new list in SharePoint with all the columns (same names and types) as the Collection as well as an additional one called UserMail - I have called the List StoreList below - you can call it whatever you want.
At App OnStart after the code above get the contents of the list that belong to the user
ClearCollect( CollectionName, Filter( StoreList, UserMail=varUserMail ) )
Now (this is actually the first bit to make it work) when you want to save this before the user exits - you will have to decide where to run this - update the contents of the user's collection, firstly by removing existing records and then adding the collection to it as new records.
RemoveIf( StoreList, UserMail=varUserMail ); Collect(StoreList,CollectionName)
One small thing you will need to do is if the user adds a new record to the collection (you did not specify this), the field UserMail will need to be populated with varUserMail value.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
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!