cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Elitezone
Post Prodigy
Post Prodigy

Dynamic gallery collection to Sharepoint list

Hello,

 

I have a gallery that has a collection as data source. And inside this gallery there are two input text boxes (single and multi)

Elitezone_0-1604053542150.png

This collection allows to add dynamically task (someone fill one task, click ADD more and he can add more tasks).

But collection is only up to the moment someone close the app.

 

When someone reload app he does not see this tasks.

 

Code:

Gallery2 Items:

 

 

colNumberedGUIDS

 

 

OnVisible screen:

 

 

If(CountRows(colNumberedGUIDS) = 0,ClearCollect( colNumberedGUIDS, {Value:GUID(),RowNumber:1}))

 

 

Add task:

 

 

Collect(colNumberedGUIDS, 
        {Value:GUID(), RowNumber:CountRows(colNumberedGUIDS) + 1}
)

 

 

 

The idea for this solution is to allow someone to add tasks whole day review it and then save it at the end of the date.

I have no idea what to do - I want user to fill the task all day, but then when they reload app they won't see it since gallery data source is already a collection (which on the other hand does not include data from input boxes - weird solution).

 

Does any of you have idea what to do?

Do I need another gallery with a sharepoint list data source?

 

Or can it be somehow done.

 

To sum it up from user perspective.

1. There is a gallery with two input boxes (Name, description).

I feel those tasks and click Save.

2. I come back later to add another task (my previous task is visible). I click add task and another task in gallery is shown.

3. I click save and leave up.

4. At the end of the day I come and click finish job and all records are saved once again, but i lose access to this screen, and it's archived.

 

Is this achievable? 

 

5 REPLIES 5
Wayne_A
Advocate III
Advocate III

You will need to start to look at working Offline with Power Apps - Shane Young's videos are a great introduction to these https://www.youtube.com/watch?v=NwbqdA9j8Ek but you're using collections o you're well on the way in the right direction.

 

@Wayne_A 

Should I use collection tho?

Collection should remain till user click a button.

Wayne_A
Advocate III
Advocate III

Yes always use a collection, then you will need to decide when to use SaveData to make sure you have captured the entries (clicking Save), then clear the collection when you Archive so you're starting from fresh the next time.


Like it? please click the Thumbs Up button!
Problem Solved? please click the Accept as Solution button to help other Community members find the answer as well!

@Wayne_A 

My app is made for browser, and SaveData LoadData does not work in browser!

 

So right now mobile users can save data locally and PC ones are left with nothing.

 

This means that I have to allow users to Patch data with Save button, but then how will they view this data when gallery is made with collection.

 

My function for collecting in gallery:

Collect(colNumberedGUIDS,
{Value:GUID(), RowNumber:CountRows(colNumberedGUIDS) + 1,Nazwa:Zadanie_nazwa.Text,Opis:Zadanie_opis.Text}
)

 

When I patch this data it will be in sharepoint list and not in gallery anymore.

So to view data I will not to have Sharepoint list as a source.

 

Or should I preload collection with sharepoint list data?

But this is very hard. It need to select only records from a certain date and created by this user to not show all data from sharepoint list.

 

The stuff that Shane did were quiet easy, but this is on another league for me.

 

Logically this should work like that:

 

1. User open gallery that has collection and fill initial task.

2. He can click a button next task or save data.

 

Saving data mean that it is saved in the database and can be viewed after reloading app.

 

Ah, yes browser users will face this issue - but as they are using a browser then yes just save back to the SP list and refresh the control/datasource afetrwards to reload the data (no need to reload the whole app).

Personally yes I would use a collection, but you don't have to and could Filter directly on the SP list.

Also check out the app ConfirmExit and ConfirmExitMessage options to maybe prompt your users to Save anything they should before exiting the app.

 


Like it? please click the Thumbs Up button!
Problem Solved? please click the Accept as Solution button to help other Community members find the answer as well!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (24,456)