hello folks welcome back in this video you will learn
how to create collection in powerapps based on sharepoint list data so stay
tuned let's go to the demo after this short intro
collection is one type of variable in powerapps
you can use a collection to store data that users can manage
in their powerapps a collection is a group of items
that are similar such as projects in a project list
in this example i will use a project list from sharepoint
and i will load it to powerapps collection
on a click of a button i will also show you how to clear a collection
so let's go to the demo i am inside office 365.
from the top left menu i will click on these ellipses
and then if i look for powerapps application i can see that here
or i can click on all apps and then if i scroll down i will be able to see
the powerapps application listed here so i will click on the powerapps now i
am inside powerapps application landing page
to create a new power app from the left hand menu
i will need to click on create link this will show me few options so i can
either create a canvas app or model driven app
or a portal in this scenario i will just create
a canvas app from blank so i will click on that
now i need to give this app a name i will just call it projects app and the
format i will just leave it tablet and then once i'm happy with the name i
can click on create this have created an empty app
for me with the default screen screen one i
will be just working on this screen so the first thing we need to do is add
a connection to our sharepoint list so if i go to the sharepoint site i can
see this project list is available on this care
point training site so we have a title of the project
project manager start date and the approval status so i need to
bring all this project information inside powerapps in a collection so if i
navigate back to the powerapps application
so let me show you where you can see the collection so from the
file tab if i click on the file tab and if i scroll down
you can see this collection link here so if i click on that
so it says that you don't have any collections yet because we haven't
created any so when we create a collection and then
we come here we will we will be able to see all the
collection data here so if i just go back now to add a connection to our
sharepoint list from the very left menu i will click on this data
icon and then there is no data in this app
yet because this is a brand new app i will click on add data
and then i have to search for the data source or i can just start typing
sharepoint so i will be selecting the sharepoint as
the data source so i will click on it now you can add a connection to the
sharepoint data source i have already used it in
the past so i have a few connections listed here so i will select one of them
on the right hand side you can see that it is asking me
to enter the site url or i can use one of the recent site
so the site is listed here but just for this
demo purpose i will take the url of the site so
if i go back to the site home page i will just need the url
of the site and if i go back to the app i go the site url
i can just paste that url here and click on
connect this will show me all the libraries and lists available
inside this site we are only interested in the project list
so i will select the project list and then i will click on
connect so we have managed to add connection to the project list
and the connection name is going to be projects now we need
few things in this screen so we can navigate back to
the tree view so I need two buttons here so one will be
adding the SharePoint list to collection and the second one will be
used to clear the collection and then we also create
a gallery to show the collection data so if i click on the insert tab and
click on button and then click on button again so we
have two buttons now if we just select one button add to
collection and let's rename the other button to clear
collection we'll just resize them a little bit so
the text can fit better on the buttons okay so we have done that the next thing
we need is we need to add a gallery view so we can view the
collection inside this form so if i again go to insert tab and from the
gallery drop down if i select for example this first one
vertical gallery scroll a little bit down and make it
longer this gallery is not connected to any
data source yet from the right hand menu you can see the
data source property is set to none so i can select the
projects as a data source but we don't want that
we want to show the collection inside this gallery
not the sharepoint list data so the sharepoint list data will be loaded in a
collection and we will be displaying the collection
data here so let's create a collection first so how to create a collection
is really simple so what we need to do is we need to
select this add to collection button and on select of that button we need to
create a collection instead of false i will say i will say
collect so to collect is used to make a collection
a new or existing collection to argument first we need to provide the collection
name i will say project collection and then comma and then what needs to be
added inside the collection a record or table to collect we know
that we have created a data source called projects which is
connecting to that sharepoint list so we can use that data source as
item to retrieve all the records just i type projects so i can select that and
that's it so the collection is created with the name of project
collection and the projects from sharepoint list will be added to
this collection on a click of this button so you can see from the left hand
menu under the data tab we also see project
collection collection so let's look at the files
tab and look at the collections if i go to
collections now i can see a project collection here
and it is retrieving all the columns from that sharepoint list
but it is not showing any data because we haven't run that collection
very first time so when we click on a button it is retrieving the
data and putting into this collection so if i just go
one step back and just to test it if i click on preview
the app and if i click on add to collection
and now if i close this app go to the file tab again
and look for collections and now you can see
the data is populated inside this collection
so you can see the project status title and all the other fields
in here so let's go one step back now we have retrieved the collection
we can now connect this gallery to that collection so if i go to the
tree view again and select this gallery from the left
menu and now it is suggesting me that i can connect
either with the sharepoint list data source
or with the project collection so in this case i will select
project collection now you can see straight away it is showing me
the data from this project list so the titles of the project
i can change the layout of this gallery i can just say
title and subtitle okay and in the fields i can just go edit which one i'm
going to show as the title and subtitle so for the title i can say i can say i
want to show title and for the subtitle i can say i
want to show the status i close that now the project
title and project status are appearing here
now let me run this again now if i click on add to collection
now it's gonna duplicate those records and put into collection
again now the next thing we can do is we can see how we can clear a collection
so if i select this clear button on select
i need to use method called clear and then
it is asking me what you want to clear i want to clear a project collection
which is the name of our collection and close the parenthesis
and that's it this is as simple as that this is going to clear the collection
on a click of this clear collection button so let's test that now
so you can see that there is a lot of data in that collection
so if i click on clear collection the collection is removed to see the proof
if i just go back to the file tab and go to the collections
i don't see any data in there so the collection data is clear so i can test
again i can add it to collection so you can see the data here and again
it's duplicating now if i clear collection so to just wrap up this video
today you have learned how to create collection
in power apps based on shape on list data
thank you very much for watching this video consider subscribing if you're new
to the channel by pressing the red subscribe button below this video
and click the notification bell icon so you don't miss any of my future videos
as i upload new videos every week give this video a thumbs up if you found it
useful if you have any question regarding this
topic or any other query related to office 365
please put in the comment section below i review user comments on
the daily basis i will be happy to answer your questions
thank you