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
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
Highlighted
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
Frequent Visitor

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
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (1,444)