cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
connor
Level: Powered On

SortByCloumns With 2 Sort Buttons

Hi there, 

I am looking for some help figuring out how to have two or (more) sort buttons with a gallery using SortByColumns.

Here is my formula on my gallaery's item property:

SortByColumns(
    Filter(
        '[CATEGORY]' , DELETE_FLG = "N" And 
        (Upper(inpSearchCateory1.Text) in Upper(CATEGORY_NAME) Or 
         Upper(inpSearchCateory1.Text) in Upper(DESCRIPTION))),
        "CATEGORY_NAME",
            If(sortDescending, Descending, Ascending),
        "DESCRIPTION",
            If(sortDescending2,Descending, Ascending)
       )

At the movment, I can only get one sort button to work, but not both.

Here is a screen gab for reference:
 Sortexample.JPG

 

I have played around witha few IF statemnets but no luck so far. 

Thank you for the advice and help
-Connor

1 ACCEPTED SOLUTION

Accepted Solutions
AndySid
Level 8

Re: SortByCloumns With 2 Sort Buttons

This may help, in this example I am sorting a dataTable based on different dropdown values (in your case buttons) You need to set a variable and use the Switch function to change...

 

example button 1: UpdateContext ({filterBy:1})

example button 2: UpdateContext ({filterBy:2})

 

DataTable Items:

Switch(filterBy,1, SortByColumns(Filter(appDailyJobSheets_1, Employee = Dropdown2_1.Selected.Value && Status = "New"),"Start_x0020_Time"),2,SortByColumns(Filter(appDailyJobSheets_1, ContractNo = cboDropContractNo2_1.Selected.Contract && Status = "New"),"Start_x0020_Time"))

 

 

2 REPLIES 2
AndySid
Level 8

Re: SortByCloumns With 2 Sort Buttons

This may help, in this example I am sorting a dataTable based on different dropdown values (in your case buttons) You need to set a variable and use the Switch function to change...

 

example button 1: UpdateContext ({filterBy:1})

example button 2: UpdateContext ({filterBy:2})

 

DataTable Items:

Switch(filterBy,1, SortByColumns(Filter(appDailyJobSheets_1, Employee = Dropdown2_1.Selected.Value && Status = "New"),"Start_x0020_Time"),2,SortByColumns(Filter(appDailyJobSheets_1, ContractNo = cboDropContractNo2_1.Selected.Contract && Status = "New"),"Start_x0020_Time"))

 

 

connor
Level: Powered On

Re: SortByCloumns With 2 Sort Buttons

Ah, I like your thinking @AndySid. At this moment, I beleive this should work! Thank you.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 90 members 4,077 guests
Please welcome our newest community members: