Forum Discussion

christina_hoeglinger's avatar
christina_hoeglinger
Copper Contributor
Oct 15, 2019

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

Can anyone help me with that?

 

Thank you!

  • 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

Resources