cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RobHel
Frequent Visitor

Gallery with a Dropdown and Search Function

Hello,

 

Help required please - I've read every post I can find on this topic and still can't get it working correctly

 

I have a gallery with a dropdown box and search box - the only way I've managed to get them both working together is when a selection is made on Teacher, not searching on All Students.......This is what I have so far:

 

SortByColumns(Switch(Dropdown2.Selected.Value,"All Students", 'Student Details', Filter('Student Details', 'Teacher'.Email = User().Email, Searchbox.Text in Title || Searchbox. Text in Mobile || Searchbox.Text in Surname)), "Surname", Ascending) 

 

Appreciate any help on this one

1 ACCEPTED SOLUTION

Accepted Solutions

Ok thanks @RobHel ,'

The problem is guessing exactly what you need - you will want the searches to work even on "All Students"? Just move some  brackets as below and also allowed for blank search box

SortByColumns(
   Filter(
      'Student Details', 
      If(
         Dropdown2.Selected.Value = "All Students",
         true,
         'Teacher'.Email = User().Email
      ) &&
      If(
         IsBlank(SearchBox.Text),
         true,      
         Searchbox.Text in Title || 
         Searchbox.Text in Mobile || 
         Searchbox.Text in Surname
      )
   ), 
   "Surname", 
   Ascending
) 

 

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

4 REPLIES 4
WarrenBelz
Super User
Super User

Hi @RobHel ,'

Try this

SortByColumns(
   Filter(
      'Student Details', 
      If(
         Dropdown2.Selected.Value = "All Students",
         true,
         'Teacher'.Email = User().Email &&
         (
            Searchbox.Text in Title || 
            Searchbox.Text in Mobile || 
            Searchbox.Text in Surname
         )
      )
   ), 
   "Surname", 
   Ascending
) 

 

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.

Thank you for such a fast response, I tried suggestion, unfortunately I am coming up with the same result with the search only working on the selected Teacher choice not All Students

Ok thanks @RobHel ,'

The problem is guessing exactly what you need - you will want the searches to work even on "All Students"? Just move some  brackets as below and also allowed for blank search box

SortByColumns(
   Filter(
      'Student Details', 
      If(
         Dropdown2.Selected.Value = "All Students",
         true,
         'Teacher'.Email = User().Email
      ) &&
      If(
         IsBlank(SearchBox.Text),
         true,      
         Searchbox.Text in Title || 
         Searchbox.Text in Mobile || 
         Searchbox.Text in Surname
      )
   ), 
   "Surname", 
   Ascending
) 

 

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.

 

Perfect, just what I'm after - thank you kind sir

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,628)