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 / SortByButton for two g...
Power Apps
Unanswered

SortByButton for two gallery collections

(0) ShareShare
ReportReport
Posted on by 39

So I have a page with two galleries which contain collections in each one.

I want to sort by date for both collections in their respective galleries using ONE sortByButton.

Collection1: BuyDate

Collection2: UseDate

 

What code do I need to use to simultneously sort both galleries using one sortbyButton?

 

My current Onselect code is -:   UpdateContext({SortDescending: !SortDescending})  

Categories:
  • WiZey Profile Picture
    3,023 Moderator on at

    Hello @tsangd ,

     

    You need "sort()" to... Sort your collection. 

     

    The sort order is actually an enum and not a boolean, so you will need to change that into a condition.

     

    Can you try the code below and see how it goes please ?

     

    Items=Sort(DataSourceToSort, ColumnToSort, If(SortDescending, SortOrder.Descending, SortOder.Ascending))

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 409 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 252 Most Valuable Professional

Last 30 days Overall leaderboard