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."

 

 

View solution in original post

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,818)