cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate III
Advocate III

Want to use Sort first and then Filter

HI All,

I have a gallery that I filter on through a search box. I would like the gallery to have a default sort order, though. The filter works just fine:

If(ddlSearchType.Selected.Value = "Customer Name", Filter('SharePointDataSource', txtSearch.Text in Customer_x0020_Name ), ddlSearchType.Selected.Value = "Resolved Status", Filter('SharePointDataSource', txtSearch.Text in Resolved.Value),ddlSearchType.Selected.Value = "Corporate Account Manager", Filter('SharePointDataSource', txtSearch.Text in CAM_x0020_on_x0020_Account.Value), ddlSearchType.Selected.Value = "Invoice Number", Filter('SharePointDataSource', txtSearch.Text in Invoice_x0020_Number), ddlSearchType.Selected.Value = "Regional Director", Filter('SharePointDataSource', txtSearch.Text in Regional_x0020_Director.Value), ddlSearchType.Selected.Value = "Working Status", Filter('SharePointDataSource', txtSearch.Text in Working_x0020_Status.Value), ddlSearchType.Selected.Value = "Account Coordinator", Filter('SharePointDataSource', txtSearch.Text in A_x002f_C.Value))

However, I'd like to sort first by Account Coordinator (A_x002f_C.Value) in ascending and when I try to add a Sort field to the front of the expression, I get errors. How can I add Sort to the expression above so I can Sort and then Filter?

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

 

I just want to sort by one column, but also to use the filter. I'd like it to sort by that one column and then filter, but when I try to add sort I get errors. I've added Sort to the beginning of the filter and then the value and ascending to the end, as so:

Sort(If(ddlSearchType.Selected.Value = "Customer Name", Filter('Universal Dispute Log', txtSearch.Text in Customer_x0020_Name ), ddlSearchType.Selected.Value = "Resolved Status", Filter('Universal Dispute Log', txtSearch.Text in Resolved.Value),ddlSearchType.Selected.Value = "Corporate Account Manager", Filter('Universal Dispute Log', txtSearch.Text in CAM_x0020_on_x0020_Account.Value), ddlSearchType.Selected.Value = "Invoice Number", Filter('Universal Dispute Log', txtSearch.Text in Invoice_x0020_Number), ddlSearchType.Selected.Value = "Regional Director", Filter('Universal Dispute Log', txtSearch.Text in Regional_x0020_Director.Value), ddlSearchType.Selected.Value = "Working Status", Filter('Universal Dispute Log', txtSearch.Text in Working_x0020_Status.Value), ddlSearchType.Selected.Value = "Account Coordinator", Filter('Universal Dispute Log', txtSearch.Text in A_x002f_C.Value)),A_x002f_C.Value, Ascending)

However, I get errors with this and it is probably something I'm missing!

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hello,

 

Have you tried embedding the Sort function? The Sort function works on one column at a time. So to sort on 2 columns (CustomerNumber and OrderDate in the Orders table), the following would work:

 

Sort( Sort( Orders, CustomerNumber ), OrderDate )

 

Hope this helps.

Hi,

 

I just want to sort by one column, but also to use the filter. I'd like it to sort by that one column and then filter, but when I try to add sort I get errors. I've added Sort to the beginning of the filter and then the value and ascending to the end, as so:

Sort(If(ddlSearchType.Selected.Value = "Customer Name", Filter('Universal Dispute Log', txtSearch.Text in Customer_x0020_Name ), ddlSearchType.Selected.Value = "Resolved Status", Filter('Universal Dispute Log', txtSearch.Text in Resolved.Value),ddlSearchType.Selected.Value = "Corporate Account Manager", Filter('Universal Dispute Log', txtSearch.Text in CAM_x0020_on_x0020_Account.Value), ddlSearchType.Selected.Value = "Invoice Number", Filter('Universal Dispute Log', txtSearch.Text in Invoice_x0020_Number), ddlSearchType.Selected.Value = "Regional Director", Filter('Universal Dispute Log', txtSearch.Text in Regional_x0020_Director.Value), ddlSearchType.Selected.Value = "Working Status", Filter('Universal Dispute Log', txtSearch.Text in Working_x0020_Status.Value), ddlSearchType.Selected.Value = "Account Coordinator", Filter('Universal Dispute Log', txtSearch.Text in A_x002f_C.Value)),A_x002f_C.Value, Ascending)

However, I get errors with this and it is probably something I'm missing!

View solution in original post

Advocate III
Advocate III

It is now working, sorry about that! 

Helpful resources

Announcements
secondImage

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Top Kudoed Authors
Users online (46,910)