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

Help with Gallery Filtering

I have the below code:

SortByColumns(Search('To Do List', TextSearchBox1.Text, "Title"), "ID", If(SortDescending1, Descending, Ascending))

 

I need the gallery not to display results from the sharepoint data sorce that comply with the status "Completed" Ive read a few other posts but struggling to mix the code in with mine. Tom

1 ACCEPTED SOLUTION

Accepted Solutions
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Help with Gallery Filtering

Ah, if your sharepoint column is named "Status", and (it seems to be) of type choice, then the expression should reference that column name, something along the lines of 

SortByColumns(
    Search(
        Filter('To Do List', Status.Value <> "Completed"),
        TextSearchBox1.Text,
        "Title"),
    "ID",
    If(SortDescending1, Descending, Ascending))

View solution in original post

5 REPLIES 5
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Help with Gallery Filtering

You would use the Filter function in this scenario:

SortByColumns(
    Filter(
        Search('To Do List', TextSearchBox1.Text, "Title"),
        Completed = false),
    "ID",
    If(SortDescending1, Descending, Ascending))

Expressions in PowerApps can be nested, so in the example above you're filtering the result of the Search operation based on the condition that you want.

TomWright
Level: Powered On

Re: Help with Gallery Filtering

Hi Carlos,

 

Is it possible to only show items in the gallery were completed is false, before the search is run

PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Help with Gallery Filtering

Sure, both Search and Filter functions "filter" the rows that are returned by the data source, without changing its "shape", so their order can be flipped, and the results should be the same:

SortByColumns(
    Search(
        Filter('To Do List', Completed = false),
        TextSearchBox1.Text,
        "Title"),
    "ID",
    If(SortDescending1, Descending, Ascending))
TomWright
Level: Powered On

Re: Help with Gallery Filtering

Thanks, altough how does it know what colum to look in for the "Completed status"? This is the sharepoint formIMG2.JPG

No results are being retunred?

IMG1.JPG

 

Thank you for your help, its much appreciated

PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Help with Gallery Filtering

Ah, if your sharepoint column is named "Status", and (it seems to be) of type choice, then the expression should reference that column name, something along the lines of 

SortByColumns(
    Search(
        Filter('To Do List', Status.Value <> "Completed"),
        TextSearchBox1.Text,
        "Title"),
    "ID",
    If(SortDescending1, Descending, Ascending))

View solution in original post

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 (3,730)