cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Blue281
New Member

Search Function ID and second column from one text box

Hello,

 

I'm trying to have my gallery have a search function using 1 dropdown and 1 text box. My search function currently works for the drop down and the text box but as soon as i try introduce ID to the search function it fails. 

 

This code works perfectly

Search(
If(Dropdown1.Selected.Result = "All", 'CI Funnel', Filter('CI Funnel', 'Department ' = Dropdown1.Selected.Result)),
SearchItem.Text,"Current_x0020_State")

 

But as soon as i try add ID as seen below

 

Search(
If(Dropdown1.Selected.Result = "All", 'CI Funnel', Filter('CI Funnel', 'Department ' = Dropdown1.Selected.Result)),
SearchItem.Text,"Current_x0020_State", "ID")

 

My guess is that value of ID is not seen as text but I'm not sure how to fix this

Any help would be appreciated 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @Blue281 :

The point is that the search function only work for text column.

vbofengmsft_0-1631515985701.png

You could try this formula:

 

Filter(
   If(
      Dropdown1.Selected.Result = "All", 'CI Funnel', 
      Filter('CI Funnel', 'Department ' = Dropdown1.Selected.Result)
   ),
   SearchItem.Text in 'Current_x0020_State' || SearchItem.Text = "ID"
)

 

Best Regards,

Bof

 

View solution in original post

6 REPLIES 6
zmansuri
Super User
Super User

Not sure. But can you try this?

 

If(Dropdown1.Selected.Result = "All", 'CI Funnel', Filter('AddColumn('CI Funnel',"IDText",Text(ID)), 'Department ' = Dropdown1.Selected.Result)),
SearchItem.Text,"Current_x0020_State", "IDText")

Thanks but unfortunately that gives me an error as there isn't a column called "IDText" 

That's why we are adding one

 

If(Dropdown1.Selected.Result = "All", 'CI Funnel', Filter('AddColumn('CI Funnel',"IDText",Text(ID)), 'Department ' = Dropdown1.Selected.Result)),
SearchItem.Text,"Current_x0020_State", "IDText")

Sorry apologies i'm tired and didn't even see the added bit with Add column

however i still get errors as seen below 

PowerAppError.png

a.jpga2.jpga3.jpg

 

The given code works perfectly for id column. I have tested it. Your if block is causing problems i think, And honestly i don't see use of that if condition at all. You can write your code without it.

v-bofeng-msft
Community Support
Community Support

Hi @Blue281 :

The point is that the search function only work for text column.

vbofengmsft_0-1631515985701.png

You could try this formula:

 

Filter(
   If(
      Dropdown1.Selected.Result = "All", 'CI Funnel', 
      Filter('CI Funnel', 'Department ' = Dropdown1.Selected.Result)
   ),
   SearchItem.Text in 'Current_x0020_State' || SearchItem.Text = "ID"
)

 

Best Regards,

Bof

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,248)