cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
charliejbird
Regular Visitor

Search table in column selected via dropdown control

Hi All,

I want to be able to search my table in the column that has been selected via a dropdown control.

I am currently using the formula;

Search(CSPJobData,TextInput3.Text,"Title") 

But want to replace "Title" with the value from Dropdown1. It doesn't seem to accept whatever I have tried.

Does anyone know if this is possible or of a workaround to achieve this?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @charliejbird ,

That is correct - you cannot dynamically refer to Power Apps elements (names of fields, controls, forms, screens etc). You would have to hard-code it like this

Search(
   CSPJobData,
   TextInput3.Text,
   Switch(
   DropDown1.Selected.Value,
   "SelectedValue1",
   "Column1",
   "SelectedValue2",
   "Column2",
    . . . . etc
) 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 

View solution in original post

3 REPLIES 3
zmansuri
Super User
Super User

Not sure about this one, But you can try this:

Search(CSPJobData,TextInput3.Text,"DropDown1.selected.Value") 

Make sure column names are exact in dropdown

 

Sure method would be strore dropdown value in variable.

OnChange of the dropdown:

Set(varColumn,Self.Selected.Value)

and reference that variable instead of column name in your code

Search(CSPJobData,TextInput3.Text,varColumn) 

This doesn't seem to work as it is giving an error and returning no results. The search function seems to only want to accept column names.

Hi @charliejbird ,

That is correct - you cannot dynamically refer to Power Apps elements (names of fields, controls, forms, screens etc). You would have to hard-code it like this

Search(
   CSPJobData,
   TextInput3.Text,
   Switch(
   DropDown1.Selected.Value,
   "SelectedValue1",
   "Column1",
   "SelectedValue2",
   "Column2",
    . . . . etc
) 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,012)