cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Regular Visitor

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

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
Power Apps
Power Apps

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.

Hi Carlos,

 

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

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

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

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
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (74,495)