cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Hsoto7
Frequent Visitor

Sorting by Gallery and Search Box

Hello Power Apps Community, 

 

I have a gallery that I need to be able to sort via serach box and a gallery containing different values. 

 

The code I have for the search box is 

SortByColumns(Filter(RFQ,StartsWith(Title, TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))

This code works fine. 

 

What I can't figure out is how to also make it also filter by "Working Department".Value using a gallery that contains all the working department values titled "Sorting Table" when a value in the gallery is selected

 

Thank you in advance for your help

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User
Super User

@Hsoto7 

The Filter function can accept multiple criteria for filtering the gallery.  See my suggestion below in blue.

 

SortByColumns(Filter(RFQ,StartsWith(Title, TextSearchBox1.Text),yourGalleryName.Selected.'Sorting Table' = WorkingDepartment.Value), "Title", If(SortDescending1, Descending, Ascending))

 

From your message my understanding yourGalleryName contains a field called 'Sorting Table' and the datasource RFQ has a complex column named WorkingDepartment and that's why you need to reference WorkingDepartment.Value.  If WorkingDepartment is a simple column consider removing the .value from the formula.

 

---

Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly.  If your thought the post was helpful please give it a "Thumbs Up."

 

 

View solution in original post

2 REPLIES 2
Jeff_Thorpe
Super User
Super User

You can add another condition to your current formula to filter it down by the select item in the Sorting Table gallery.

 

It would look something like this but you will need to update the field names.

SortByColumns(Filter(RFQ,StartsWith(Title, TextSearchBox1.Text), SortingTableGallery.Selected.Working  = WorkingDepartment.Value

), "Title", If(SortDescending1, Descending, Ascending))



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
mdevaney
Super User
Super User

@Hsoto7 

The Filter function can accept multiple criteria for filtering the gallery.  See my suggestion below in blue.

 

SortByColumns(Filter(RFQ,StartsWith(Title, TextSearchBox1.Text),yourGalleryName.Selected.'Sorting Table' = WorkingDepartment.Value), "Title", If(SortDescending1, Descending, Ascending))

 

From your message my understanding yourGalleryName contains a field called 'Sorting Table' and the datasource RFQ has a complex column named WorkingDepartment and that's why you need to reference WorkingDepartment.Value.  If WorkingDepartment is a simple column consider removing the .value from the formula.

 

---

Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly.  If your thought the post was helpful please give it a "Thumbs Up."

 

 

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (4,126)