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 / Browsescreen sort with...
Power Apps
Unanswered

Browsescreen sort with two IconsSort buttons

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello powerapps community!

I have seen some similar questions and answers for my problem on this forum, but i didn't understand them fully.

I have a browsescreen in my app which is sorted descending by "ID" on the moment. This is fine as default , but I also want the possibility to sort on date. It is important that the user must be able to switch back to sorting (descending/ascending) on "ID" as well. I think I need two IconSort buttons for this but I dont know ho to proceed from there. Anybody who can use his magic to help me?

Cheers,

Tata66

 

 

 

Categories:
  • eka24 Profile Picture
    20,925 on at
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you!

     

    I have some questions though.

     

    What are the SiteVisitDetails and SVTList in this?

    Concurrent(ClearCollect(collAllSiteVisitDetails, SiteVisitDetails), ClearCollect(collAllSVTDetails, SVTList));

     
    I am using a SP list with colummns. 
    I was also wondering what the  "fac" is doing ?

    Set(LastSort, "fac");

     
    Cheers

  • eka24 Profile Picture
    20,925 on at
    For the clearcollect, you can ignore it. But if you are using a collection then you c an look at it. The fac is just a word they used in the visible variable, you can change to any word
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous :

    Do you want to sort the records based on the two IconSort buttons

    Do you want to implement the following functions

    • Default: The records will be sorted by "ID" .
    • Select Button1: The records will be sorted by "Date" .
    • Select Button2: The records will be sorted by "ID" .

    I think the solution mentioned by @eka24  can solve your problem. I have reorganized it for you.

    Step1:add a button(Date) and set its Onselect property to:

     

     

    UpdateContext({DateSort:!DateSort}); /* “DateSort” is a custom environment variable that can be changed to “true” or “false”*/
    UpdateContext({LastSort: "Y"}) /* “LastSort” is a custom environment variable. The value of “LastSort” is used to be a analyzing conditions of the If() function */

     

     

    Step2: add a button(ID) and set its Onselect property to:

     

     

    UpdateContext({IDSort: !IDSort});
    
    UpdateContext({LastSort: "N"})

     

     

    Step3: add a gallery and set its items property to:

     

     

    If(
    
     LastSort = "Y",
    
     Sort(
    
     Test1, /*use your data source here*/
    
     MYDATE, /*use your field name ”Date” here*/
    
     If(
    
     DateSort, 
    
     Descending,
    
     Ascending
    
     )
    
     ),
    
     Sort(
    
     Test1, /*use your data source here*/
    
     MYID, /*use your field name ”ID” here*/
    
     If(
    
     IDSort,
    
     Descending,
    
     Ascending
    
     )
    
     )
    
    )

     

    1.PNG

     

    Beat Regards,

    Bof

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 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard