cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MartinLee
Helper I
Helper I

Filter Gallery by Dropdown and/or Search Box

Good Afternoon, 

 

Im tryng to filter a gallery list i can filter in the seach box its is working good, but also would like to filter by a status in a dropdown??

 

the code im using at the moment is, 

 

SortByColumns(Search('Concierge Tracker', TextSearchBox1.Text, "Account", "Concierge_Specialist", "Vehicle_Reg"), "Date", If(SortDescending1, Descending, Ascending))

 

image.png

 

I would also like to search via a job number? does anyone know how to add this on?? 

6 REPLIES 6
CarlosFigueira
Power Apps
Power Apps

You can combine multiple Search (and Filter) usages in the same expression to search/filter by multiple conditions. For example, to filter by the value of the status shown in the dropbox, in addition to the current search, you could do

SortByColumns(
    Search(
        Filter(
            'Concierge Tracker',
            Status = DropdownStatus1.Selected.Value),
        TextSearchBox1.Text,
        "Account",
        "Concierge_Specialist",
        "Vehicle_Reg"),
    "Date",
    If(SortDescending1, Descending, Ascending))

To search for a job number, in addition to the fields you are already searching on (Account, Concierge_Specialist, Vehicle_Reg), you can pass that additional field to the Search function. That function will search the given text in all of the columns that you passed to it.

That's great Thank you,

 

the job numbers are in a number format though?  you helped me before on this formula before but im unable to get work with both, drop down and search?

 

 

hpkeong
Community Champion
Community Champion

Hi

 

Are you looking for MULTIPLE search functions?

Example:

1. Search by default from PowerApps

2. Search using Dropdown

3. Search using Gallery,...

 

Be default, PowerApps provides:

- SortByColumns(Search(CustomGallerySample, TextSearchBox2.Text, "SampleText"), "SampleText", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))

 

Rational:

1. ClearCollect all your "Sort & Search results into a Temporay Table, TableX" and list out in Gallery.Items"

2. The way to trigger ClearCollect can be

- OnSelect

- OnChange

- OnVisible,...

 

This is very useful for many scenario. "For me only", this is Simple, Easy to Understand.

You can add more behavior formula such as:

- UpdateContext to clear the TextInput when filter with Dropdown, etc.

 

You can modify this by:

- Screen.OnVisible and a Button, with

Screen,OnVisible = ClearCollect(TableX, TableBrand) &

Button.OnSelect = ClearCollect(TableX, TableBrand)

 

Then, set the

- Gallery.Items = TableX

 

Then, you can have mulltiple search as you wish.

Example:

 

1. Typical TextInput is modified as:

 

TextInput.OnChange & TextInput.OnSelect =

ClearCollect(TableX, SortByColumns(Search(TableBrand, TextSearchBox1.Text, 'Maker', 'Origin'), 'Maker', If(SortDescending1, SortOrder.Descending, SortOrder.Ascending)))

 

2. Dropdown

 

DropDown.OnChange = 

ClearCollect(TableX, SortByColumns(Search(TableBrand, Dropdown1.Selected.Result, 'Brand'), 'Maker', If(SortDescending1, SortOrder.Descending, SortOrder.Ascending)))

or using FILTER, etc. to replace Search or even others.

 

Sample with formulaSample with formulaType USA, or Choose itemsType USA, or Choose itemsClick ALL to show allClick ALL to show all

 

Hope this helps.

Have a nice day.

 

hpkeong
Nikhil2
Resolver II
Resolver II

Hello,

 

Seem like i have the same problem with the Dropdown filter, I have Search which is defined from powerapp that works fine.But i have added the new dropdown control from controls to filter the gallery column status. I needed to define two different approches which should not be interlinked to each other, means search should get the values from gallery as one search criteria and where dropdown should work in both ways to gallery like when User any of the one condition below for ex: "All" gallery should show all results and " Approved" only approved status.

 

1. Gallery is called default browsegallery1 ()

2. Status column is fetching the data from sharepoint list as "All","Open", "Pending", "Approved"(This will work when user inputs the data from the normal dropdown list from sharepoint to Powerapps) in powerapps i have defined the for subtitle3 text to "status.value".

3. Now i need to filter the gallery using dropdown when user selects the status accordingly with all other details in the gallery columns.

 

Date Filter:

1. Same goes with the datefilter when user selects startdate and enddate later when user clicks on apply button the gallery suppose to filter the date submitted column.

2. Date column uses the formula as Thisitem.created

 

Thanks in advance!

 

Capture.PNGCapture1.PNGCapture2.PNG

JordanMcNamee
Frequent Visitor

Hi,

 

I have an issue with using multiple filters on a gallery. I've used the same logic before with the version number, so it's basically if the values are blank, show all items, if not show the matching items. For some reason now version number doesn't seem to be working, does anybody have any ideas?

Thanks

JordanMcNamee_0-1647879388203.png

 

I'm pretty sure that it has to be text. You can't search in a number. Try AddColumn with the text of the number column.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,050)