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

Combine Filter and sort in PowerApps

Hi,

 

I am hoping someone can help me with a problem I am having:

I have a gallery in PowerApps. The data source is a SharePoint List (OOSListAT). 

Now I want to filter this after a yes/no choice field called "Closed". The comman I used under items for this was the following (and it worked):

Filter(OOSListAT,Closed.Value = "no")

 

Now I also want to add a function to sort the displayed value. The following code I used also worked:

SortByColumns(AddColumns(OOSListAT,"Product2",Product_x0020_Presentation.Value),"Product2",If(SortDescending1,Descending,Ascending))

The column "Product_x0020_Presentation" is a look-up field in the sharpoint list.

 

Now I want to combine those two functions, but I can't seem to get it to work. 

 

Also I would really like to add the function to search the gallery because there will be more than one entry for example for ProductA. So I want the option to enter 'ProductA' in the search bar and get all entries for this product. Is this possible?

 

This is how my app looks at the moment (the search bar doesn't yet work).

FilterAndSort.JPG

Can anyone help me with that?

 

Thank you in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support Team
Community Support Team

Re: Combine Filter and sort in PowerApps

Hi @christina_hoeg ,

Could you please share a bit more about your scenario?

Do you want to filter your Gallery Items based on the "Closed" field and TextSearchbox, and then sort it by a specific column?

 

I have made a test on my side, please consider take a try with the following workaround:

Set the Items property of the Gallery to following:

SortByColumns(
Filter(
AddColumns(OOSListAT, "Product2", Product_x0020_Presentation.Value),
Closed.Value = "no",
StartsWith(Product2, TextSearchBox1.Text)
),
"Product2",
If(SortDescending1,Descending,Ascending)
)

or

SortByColumns(
Filter(
AddColumns(OOSListAT, "Product2", Product_x0020_Presentation.Value),
Closed.Value = "no",
TextSearchBox1.Text in Product2
),
"Product2",
If(SortDescending1,Descending,Ascending)
)

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Combine Filter and sort in PowerApps

The order to combine those would go like this:

 

SortByColumns(
 Filter(
  Search(
   AddColumns(DataSource,"ColumnName","ColumnSource"),
  input_SearchText.Text, "ColumnSearch1","ColumnsSearch2"),
 ColumnFilter="Description"),
"ColumnSort", If(SortDescending1, Descending,Ascending))

 

Highlighted
Community Support Team
Community Support Team

Re: Combine Filter and sort in PowerApps

Hi @christina_hoeg ,

Could you please share a bit more about your scenario?

Do you want to filter your Gallery Items based on the "Closed" field and TextSearchbox, and then sort it by a specific column?

 

I have made a test on my side, please consider take a try with the following workaround:

Set the Items property of the Gallery to following:

SortByColumns(
Filter(
AddColumns(OOSListAT, "Product2", Product_x0020_Presentation.Value),
Closed.Value = "no",
StartsWith(Product2, TextSearchBox1.Text)
),
"Product2",
If(SortDescending1,Descending,Ascending)
)

or

SortByColumns(
Filter(
AddColumns(OOSListAT, "Product2", Product_x0020_Presentation.Value),
Closed.Value = "no",
TextSearchBox1.Text in Product2
),
"Product2",
If(SortDescending1,Descending,Ascending)
)

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

christina_hoeg
Level: Powered On

Re: Combine Filter and sort in PowerApps

@v-xida-msft  thank you so much for you help! the second option was exactly what I needed!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,759)