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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Sort a collection and ...
Power Apps
Answered

Sort a collection and change at data source

(0) ShareShare
ReportReport
Posted on by 204

Hi Guys,

 

Was wondering how to sort a collection and save the results within the actual collection.

 

Example I want to sort collection 'mycol' column 'Type' in alphabetical order. I want the collection to rearrange in this order. 

 

I know how to show it sorted in tables, a gallery, dropdown list etc. Although, I want to rearrange the data at the source which is within my actual collection.

 

Any help is greatly appreciated.

 

Thanks

Categories:
I have the same question (0)
  • Constrictor64 Profile Picture
    50 on at

    The easiest way would be to create a temporary collection and then clear collect the results of that back to the real collection.

     

    ClearCollect(myTempCollection, Sort(mycol, Type));
    ClearCollect(mycol, myTempCollection);
  • Verified answer
    WarrenBelz Profile Picture
    154,401 Most Valuable Professional on at

    Hi @christian12 ,

    You can do it in one action like this

    With(
     {wCol: mycol},
     ClearCollect(
     mycol,
     Sort(
     wCol,
     Type
     )
     )
    )

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Constrictor64 Profile Picture
    50 on at

    Yes, this is a much cleaner solution as you don't have a temporary collection laying around taking up memory as well.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 94

#2
WarrenBelz Profile Picture

WarrenBelz 82 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 38 Super User 2026 Season 1

Last 30 days Overall leaderboard