Combine Filter and sort in PowerApps

Copper Contributor

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!

1 Reply

Hi @christina_hoeglinger,

 

I don't know how to combine those functions either but, for the search bar you can use code similar to below:

 

SortByColumns(Filter([@'Site Security - Detail'],StartsWith(Member.DisplayName,TextSearchBox1.Text),Current.Value="Yes"),"Title",If(SortDescending1,Descending,Ascending))

 

Where:

  • [@'Site Security - Detail'] is OOSListAT
  • Member.DisplayName is the column name you want to search for
  • TextSearchBox1.Text is the name of the search box

 

In my app it sorts as expected. Hopefully this will work for you as well.

 

I hope this helps.

 

Norm