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 Apps
Answered

Sort Gallery Help

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello dear ones .

I need help with the sort function for a gallery based on a collection.

below you can see the code where it actually has to go in ....but I just can't do it

 

Macbek_0-1635312417002.png 

or do the sort arrows have to be included in the gallery ?

Macbek_0-1635316086799.png

 

 

 

Categories:
I have the same question (0)
  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Anonymous Ist you will need some variables to determine the column to be sorted on and the direction of the Sort. For example, for the Start column, in the OnSelect of that up/down icon, you have to have,

    Set(varSortColumn, "Start")

    Set(varStartSortAscending, !varStartSortAscending). 

    You have to do the same for the other 2 columns (Agent & Date)

    In the Items property of the Gallery,

    Switch(varSortColumn,

         "Start", Sort(ColGridData, Start.Value, If(varStartSortAscending, Ascending, Descending),

         "Agent", Sort(ColGridData, Agent.Value, If(varAgentSortAscending, Ascending, Descending),

         "Date", Sort(ColGridData, Date.Value, If(varStartSortAscending, Ascending, Descending),

    )

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi and many thanks already

    unfortunately it does not recognise the collection
    and I have renamed it to varSortColumnStart because it was already in use

    Macbek_1-1635334603769.png

     

     

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Anonymous Add a ")" after Descending in each case.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Sorry aber nein... ich habe auch alles probiert 

    Macbek_0-1635336617874.pngMacbek_1-1635336681472.png

    Macbek_2-1635336787714.png

     

  • Verified answer
    CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Anonymous Remove the comma "," before the last bracket ")"

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    How lovely .... thank you so much

    Macbek_0-1635338218005.png

     

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Anonymous Glad to help!

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 70

#2
WarrenBelz Profile Picture

WarrenBelz 64 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 36 Super User 2026 Season 1

Last 30 days Overall leaderboard