cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sudosaurus
Post Partisan
Post Partisan

Sort gallery by custom column with filter

Hello,

 

I am using this filter for my gallery however I wish to sort this Descending with the newest items at the top.

 

 

Filter(Register,
    (IsBlank(Search_textinput.Text) || Search_textinput.Text in 'Contract Ref' & 'External Party' & 'Contract Name' & 'Contract Description' & 'Contract tracking details' & 'Contract tracking date' & 'Contract Category'.Value
     ) &&
    (Directorate_dd.Selected.Result = "Directorate" || Directorate.Value = Directorate_dd.Selected.Result) &&
    (ContractStatus_dd.Selected.Result = "Contract Status" || 'Contract Status'.Value = ContractStatus_dd.Selected.Result
     ) &&
    (ContractCategory_dd.Selected.Result="Category" || 'Contract Category'.Value = ContractCategory_dd.Selected.Result)
)  


SortByColumns([DataSource], "Contract Ref", If(SortDescending1, Descending, Ascending))

 

 

I am figuring out how to sort this by the column 'Contract Ref'  (Descending).

 

Thanks,

Chris

1 ACCEPTED SOLUTION

Accepted Solutions

I managed to sort (no pun intended :D) it this way...

 

Sort(
Filter(Register,
    (IsBlank(Search_textinput.Text) || Search_textinput.Text in 'Contract Ref' & 'External Party' & 'Contract Name' & 'Contract Description' & 'Contract tracking details' & 'Contract tracking date' & 'Contract Category'.Value
     ) &&
    (Directorate_dd.Selected.Result = "Directorate" || Directorate.Value = Directorate_dd.Selected.Result) &&
    (ContractStatus_dd.Selected.Result = "Contract Status" || 'Contract Status'.Value = ContractStatus_dd.Selected.Result
     ) &&
    (ContractCategory_dd.Selected.Result="Category" || 'Contract Category'.Value = ContractCategory_dd.Selected.Result)
),
ID,
Descending
)  

View solution in original post

2 REPLIES 2
KvB1
Solution Specialist
Solution Specialist

Your Filter function should be inside the SortByColumns function, eg the filtered datasource is the datasource for your Sort function.

I managed to sort (no pun intended :D) it this way...

 

Sort(
Filter(Register,
    (IsBlank(Search_textinput.Text) || Search_textinput.Text in 'Contract Ref' & 'External Party' & 'Contract Name' & 'Contract Description' & 'Contract tracking details' & 'Contract tracking date' & 'Contract Category'.Value
     ) &&
    (Directorate_dd.Selected.Result = "Directorate" || Directorate.Value = Directorate_dd.Selected.Result) &&
    (ContractStatus_dd.Selected.Result = "Contract Status" || 'Contract Status'.Value = ContractStatus_dd.Selected.Result
     ) &&
    (ContractCategory_dd.Selected.Result="Category" || 'Contract Category'.Value = ContractCategory_dd.Selected.Result)
),
ID,
Descending
)  

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,875)