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

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
Community Support

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
Highlighted
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
Community Support

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

Highlighted
Advocate I
Advocate I

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
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,932)