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

Notifications

Announcements

Community site session details

Community site session details

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

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
    152,859 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 759 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 310 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 228

Last 30 days Overall leaderboard