cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
forcedLightning
Advocate I
Advocate I

Search Input Box to search dynamic columns in source

Hello!

 

I am trying to make a search box in my powerapp where a user can choose what fields they want to search. It's fairly standard functionality, where a search box has an option set at the right side where you can choose what to search, i.e. "All", "Name", "Department", "Office", etc. It seems the "Search" formula in PowerApps does not allow for any kind of dynamic content whatsoever. I've tried giving it a string, array, if statement, and everything else I could think of. It only takes an actual string. Is there any way around this??

1 ACCEPTED SOLUTION

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @forcedLightning ,

Do you want to search based on different fields if you select different value in the drop down?

If so, firstly let me explain where's your problem.

Please notice the syntax of Search function:

SearchTableSearchStringColumn1 [, Column2, ... ] )

Column name should be constant value in this formula. If you use If statement to display dynamic column name, it will not be constant value.

You should use If statement outside search function.

For example:

If(drop down.selected.displayname=All,
Search(table,"Title","LastName","JobTitle",...),
drop down.selected.displayname=Department,
Search(table,"DepartmentValue"),
....)

 

If you still have problems, please show me completed formulas about the drop down and the gallery.

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
eka24
Super User III
Super User III

Your 3rd screenshot which contains the formula is no completely clear. Also copy and paste the formula instead.

Meanwhile Shane Young has a very on the search and dropdown mixed.

https://youtu.be/W0w8PHiOnqY

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

v-yutliu-msft
Community Support
Community Support

Hi @forcedLightning ,

Do you want to search based on different fields if you select different value in the drop down?

If so, firstly let me explain where's your problem.

Please notice the syntax of Search function:

SearchTableSearchStringColumn1 [, Column2, ... ] )

Column name should be constant value in this formula. If you use If statement to display dynamic column name, it will not be constant value.

You should use If statement outside search function.

For example:

If(drop down.selected.displayname=All,
Search(table,"Title","LastName","JobTitle",...),
drop down.selected.displayname=Department,
Search(table,"DepartmentValue"),
....)

 

If you still have problems, please show me completed formulas about the drop down and the gallery.

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thank you! This is what I needed.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,676)