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

Can I search based on a dropdown within a filter

I want to filter my view in SQL, which is based on a search box and  a dropdown with a column name

I can't get this to work, is this possible?

the attached picture explains my problem

within the dropbox, I have 'Name' 'Description' which are fields within my SQL view gallery

So if Name is selected, the user can search by name

If description is selected, the user can search by description

1 ACCEPTED SOLUTION

Accepted Solutions
cwebb365
Level 10

Re: Can I search based on a dropdown within a filter

Since you have a SQL back end, luckily it makes it easier. 

 

You can just do something in your filter like Filter('datasource', Description in Field.text)

6 REPLIES 6
cwebb365
Level 10

Re: Can I search based on a dropdown within a filter

I don't know if there is a better way to do it, but you could just use an IF on the gallery. 

 

So IF(Dropdown.value = "Name", Filter(your filterto get name), Filter(your filter to get desc.))

 

If you need more you can nest if's, but that's the quick and easy way to get it now lol... 

jesenavaranjan
Level: Powered On

Re: Can I search based on a dropdown within a filter

If(FilterInput.Value="Name",Filter('[dbo].[tbMilestone]',Name=SearchInput.Text),'[dbo].[tbMilestone]')

 

Thank you! Is there anything wrong with my syntax above? and it's not working...

cwebb365
Level 10

Re: Can I search based on a dropdown within a filter

Yeah you need description in there too if you're searching for it. 

 

If(FilterInput.Value="Name",Filter('[dbo].[tbMilestone]',Name=SearchInput.Text),Filter('[dbo].[tbMilestone]',Description=SearchInput.Text))

jesenavaranjan
Level: Powered On

Re: Can I search based on a dropdown within a filter

Thanks


Actually I had to do: If(FilterInput.Selected.Value="Name",Filter('[dbo].[vwMilestone]',Name=SearchInput.Text),Filter('[dbo].[vwMilestone]',Description=SearchInput.Text))

 

Also if I want the search to no be strictly equal to, how do I handle that?

Like a %like% and ignoring cases?

Jese

cwebb365
Level 10

Re: Can I search based on a dropdown within a filter

Since you have a SQL back end, luckily it makes it easier. 

 

You can just do something in your filter like Filter('datasource', Description in Field.text)

jesenavaranjan
Level: Powered On

Re: Can I search based on a dropdown within a filter

THANK YOU

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 347 members 5,186 guests
Please welcome our newest community members: