Home

Combine Filter and sort in PowerApps

%3CLINGO-SUB%20id%3D%22lingo-sub-915610%22%20slang%3D%22en-US%22%3ECombine%20Filter%20and%20sort%20in%20PowerApps%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-915610%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20hoping%20someone%20can%20help%20me%20with%20a%20problem%20I%20am%20having%3A%3C%2FP%3E%3CP%3EI%20have%20a%20gallery%20in%20PowerApps.%20The%20data%20source%20is%20a%20SharePoint%20List%20(OOSListAT).%26nbsp%3B%3C%2FP%3E%3CP%3ENow%20I%20want%20to%20filter%20this%20after%20a%20yes%2Fno%20choice%20field%20called%20%22Closed%22.%20The%20comman%20I%20used%20under%20items%20for%20this%20was%20the%20following%20(and%20it%20worked)%3A%3C%2FP%3E%3CP%3E%3CSPAN%3EFilter(OOSListAT%2CClosed.Value%20%3D%20%22no%22)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%20I%20also%20want%20to%20add%20a%20function%20to%20sort%20the%20displayed%20value.%20The%20following%20code%20I%20used%20also%20worked%3A%3C%2FP%3E%3CP%3E%3CEM%3ESortByColumns(AddColumns(OOSListAT%2C%22Product2%22%2CProduct_x0020_Presentation.Value)%2C%22Product2%22%2CIf(SortDescending1%2CDescending%2CAscending))%3C%2FEM%3E%3C%2FP%3E%3CP%3EThe%20column%20%22%3CI%3EProduct_x0020_Presentation%3C%2FI%3E%22%20is%20a%20look-up%20field%20in%20the%20sharpoint%20list.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%20I%20want%20to%20combine%20those%20two%20functions%2C%20but%20I%20can't%20seem%20to%20get%20it%20to%20work.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%20I%20would%20really%20like%20to%20add%20the%20function%20to%20search%20the%20gallery%20because%20there%20will%20be%20more%20than%20one%20entry%20for%20example%20for%20ProductA.%20So%20I%20want%20the%20option%20to%20enter%20'ProductA'%20in%20the%20search%20bar%20and%20get%20all%20entries%20for%20this%20product.%20Is%20this%20possible%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20how%20my%20app%20looks%20at%20the%20moment%20(the%20search%20bar%20doesn't%20yet%20work).%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F137649iF72D0E8FD3CD42B4%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22FilterAndSort.JPG%22%20title%3D%22FilterAndSort.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3ECan%20anyone%20help%20me%20with%20that%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-915610%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerApps%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-916865%22%20slang%3D%22en-US%22%3ERe%3A%20Combine%20Filter%20and%20sort%20in%20PowerApps%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-916865%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F407056%22%20target%3D%22_blank%22%3E%40christina_hoeglinger%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20don't%20know%20how%20to%20combine%20those%20functions%20either%20but%2C%20for%20the%20search%20bar%20you%20can%20use%20code%20similar%20to%20below%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3ESortByColumns(Filter(%5B%40'Site%20Security%20-%20Detail'%5D%2CStartsWith(Member.DisplayName%2CTextSearchBox1.Text)%2CCurrent.Value%3D%22Yes%22)%2C%22Title%22%2CIf(SortDescending1%2CDescending%2CAscending))%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhere%3A%3C%2FP%3E%3CUL%3E%3CLI%3E%3CEM%3E%5B%40'Site%20Security%20-%20Detail'%5D%3C%2FEM%3E%20is%26nbsp%3B%3CSPAN%3EOOSListAT%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%3E%3CEM%3EMember.DisplayName%3C%2FEM%3E%20is%20the%20column%20name%20you%20want%20to%20search%20for%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%3E%3CEM%3ETextSearchBox1.Text%3C%2FEM%3E%20is%20the%20name%20of%20the%20search%20box%3C%2FSPAN%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EIn%20my%20app%20it%20sorts%20as%20expected.%20Hopefully%20this%20will%20work%20for%20you%20as%20well.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20hope%20this%20helps.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3ENorm%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
christina_hoeglinger
Occasional 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

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
30 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies