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

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
Highlighted
Dual Super User II
Dual Super User II

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
Highlighted
Dual Super User II
Dual Super User II

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

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (8,651)