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

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

4 REPLIES 4
Power Apps Staff CarlosFigueira
Power Apps Staff

Re: Filter Gallery by Dropdown and/or Search Box

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.

MartinLee
Level: Powered On

Re: Filter Gallery by Dropdown and/or Search Box

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?

 

 

Highlighted
hpkeong
Level 10

Re: Filter Gallery by Dropdown and/or Search Box

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.

 

Screenshot (212).pngSample with formulaScreenshot (213).pngType USA, or Choose itemsScreenshot (214).pngClick ALL to show all

 

Hope this helps.

Have a nice day.

 

hpkeong
Nikhil2
Level 8

Re: Filter Gallery by Dropdown and/or Search Box

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

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,343)