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

Help Filtering on Column Level Drop-Down / Search Bar - Sharepoint List

Hi All,

 

I am having a problem trying to figure out how to filter a gallery based on a drop-down menu of possible columns to search on and the text to search on those columns.

 

csmith1_1-1572448416089.png

 

Ideally, the dropdown on the right contains column names from my Sharepoint datasource. I would like to have the gallery read the text input as the search term and read the dropdown selector as where to apply the filter on the datasource.

 

The dropdown currently looks like:

 

Table(
{Value:"Name", ColumnStart: "Name"},
{Value:"Auditor Name", ColumnStart: "Auditor_Name"},
{Value:"Section Manager", ColumnStart: "Section_Manager"},

{Value:"Operator PSID", ColumnStart: "PSID_OP"},
{Value:"Date of Audit", ColumnStart: "Date_of_Audit"},
{Value:"Workstation ID", ColumnStart: "Workstation_ID"});

 

 

Currently, I am trying to do something like this in the gallery:

 

Filter(
Results,
StartsWith(

Results.(Dropdown.SelectedText.ColumnStart),SearchBar.Text),

Dropdown.SelectedText.ColumnStart)

 

Obviously that doesn't work. I am not understanding how to specify the Results.(Dropdown.SelectedText.ColumnStart) to represent the dynamic column selection.

 

I am really lost on this one. 

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Help Filtering on Column Level Drop-Down / Search Bar - Sharepoint List

Hi @csmith1 

 

You cannot dynamically define columns in the filter criteria (PowerApps does not support that)

 

Better option would be to write the logic in the filter criteria

example:

 

Switch(dropdown.selected.Value, "Name", Filter(datasource, Name = xxx), "Auditor_Name",Filter(datasource, Auditor_Name = xxx), ......

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

2 REPLIES 2
Dual Super User
Dual Super User

Re: Help Filtering on Column Level Drop-Down / Search Bar - Sharepoint List

Hi @csmith1 

 

You cannot dynamically define columns in the filter criteria (PowerApps does not support that)

 

Better option would be to write the logic in the filter criteria

example:

 

Switch(dropdown.selected.Value, "Name", Filter(datasource, Name = xxx), "Auditor_Name",Filter(datasource, Auditor_Name = xxx), ......

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

Highlighted
csmith1
Level: Powered On

Re: Help Filtering on Column Level Drop-Down / Search Bar - Sharepoint List

Really appreciate your help!

 

Ended up building out the switch case for the drop down and filtering the gallery based on the case selected by the dropdown and StartsWith() of the search bar to include all records when not searching.

 

Works great! Thanks again!

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 (5,000)