web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : BB/4GtxqrSicE0zPUhWqZG
Power Apps - Building Power Apps
Answered

Collections

Like (0) ShareShare
ReportReport
Posted on 5 Apr 2023 14:08:49 by 124

Is it possible to take SQL server table data or SharePoint list data and make it into a collection in PowerApps rather than adding individual data records to a collection?

Categories:
I have the same question (0)
  • SebS Profile Picture
    4,204 Moderator on 06 Apr 2023 at 10:14:50
    Re: Collections

    @azizrasul 

     

    happy to hear it, and don't be discourage we all was new to this in one or another point hope You enjoy the journey with Power Apps and  If You need any more support there is always someone here available to help  this community is grate for that.

     

     

  • azizrasul Profile Picture
    124 on 06 Apr 2023 at 10:06:22
    Re: Collections

    The reason why I was having a problem was that I was not pressing the Play button. I'm a newbie as you can see 🙂

     

    Thanks for your help. The example page you gave me was very useful.

  • SebS Profile Picture
    4,204 Moderator on 05 Apr 2023 at 16:38:19
    Re: Collections

    @azizrasul 

     

    I strongly recommend to just collect whole List like ClearColect(colData,SP1) and work on this list referring to columns You looking for there is no point to try go down to specific columns as this operation also impact performance to pull specific columns You will need to use ShowColumns and other functions and in the background PowerApps will pull whole DataSet any way so I do not see a point for doing this.

     

  • azizrasul Profile Picture
    124 on 05 Apr 2023 at 16:27:51
    Re: Collections

    Thanks will have a look.

  • Verified answer
    SebS Profile Picture
    4,204 Moderator on 05 Apr 2023 at 16:23:49
    Re: Collections

    @azizrasul 

     

    Please visit below link this will explain you with examples how to use collections:

    Power Apps Collections Examples (matthewdevaney.com)

     

     

  • azizrasul Profile Picture
    124 on 05 Apr 2023 at 16:17:37
    Re: Collections

    I have selected NewCollection as the data source of the gallery.

     

    What do I write in the OnSelect property of the button to get the SharePoint data into the NewCollection collection.

     

    I have tried 

     

    Collect(NewCollection,SP1,{FirstName:'First Name', Last Name:'Last Name'})

     

    but all I get is errors.

  • SebS Profile Picture
    4,204 Moderator on 05 Apr 2023 at 15:58:54
    Re: Collections

    @azizrasul 

     

    So SharePoint creating a lot of support columns and what you see right now is all that data is pulled from SP List. You can ignore it.

     

    Main Columns will be First Name and Last name and you can refer to them depend of situation

     

    Example if You pass this Collection to Gallery items property You will be able to create a label and refer to columns by using "ThisItem" and in your case it will look like ThisItem.'First Name' keep in mind if You used Title column and You did rename it to First Name for example You always will refer to it as Title means You will use ThisItem.Title to display First Name in a label. 

     

    You can use collection outside of gallery as well but this will be harder as collection have multiple records and You will need to point to right record to display Text for example in a label out side of the Gallery.

     

     

  • azizrasul Profile Picture
    124 on 05 Apr 2023 at 15:38:30
    Re: Collections

    So clearing the data is fine, I understand that now.

     

    What I'm still stuck in my understanding is if, let's say I have a SharePoint list called "SP1" which contains say 2 columns "First Name" and "Last Name". I have a PowerApps project open with a blank canvas containing a single button. 

     

    If on the OnSelect property of the button I insert 

     

    Collect(NewCollection,SP1)

     

    and then go to Collections, I can see the NewCollection as this is the only collection I have, I see there are no records and the field names are not what I have in my SharePoint list and there a lot of field names.

     

  • Ygor Profile Picture
    44 on 05 Apr 2023 at 14:49:49
    Re: Collections

    You can use ClearCollect function. The ClearCollect function deletes all the records from a collection. And then adds a different set of records to the same collection.

    This link can help you understand how to use collections:
    Collect, Clear, and ClearCollect functions in Power Apps 

  • SebS Profile Picture
    4,204 Moderator on 05 Apr 2023 at 14:42:59
    Re: Collections

    @azizrasul 

     

    If You used Clear(Collection) You can just again do Collect() or ClearCollect() to upload new data to that collection.

     

    you can also use UpdateIF(), Patch() and RemoveIF() with Collections it's all depend what You need to achive.

     

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 898 Most Valuable Professional

#2
Power Apps 1919 Profile Picture

Power Apps 1919 356

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 305 Super User 2025 Season 2

Last 30 days Overall leaderboard
Loading started
Loading complete