cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ahhollan Helper IV
Helper IV

Filter by text box or drop down

I'm very new to Power Apps. I'm connected to our Office 365 users connector. I've built an ee directory and am trying to set it up so that i can filter the list by either a user name in a text box OR a drop down list of departments.  I'm not sure how to do this. Do I create the filter on the Gallery filter? if so, what is the syntax? Please help!!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Re: Filter by text box or drop down

Hi @ahhollan 

 

You can reference @ahhollan 's suggestions.

Add one Gallery control, one textinput control,and rename the control as Gallery3, Textinput1

Gallery3.Items=Filter(Office365Users.SearchUser(),DisplayName = TextInput1.Text)    (you can use DisplayName and other properties as Id,Title ...)

textinput1.PNG

And if you want to use one dropdown control.

Dropdown.Items=Office365Users.SearchUser().DisplayName

Gallery.Items=Filter(Office365Users.SearchUser(),DisplayName = Dropdown.Selected.DisplayName)

 

More information:

control-gallery

function-filter-lookup

control-text-input

control-drop-down

 

Best Regards.

Yumia

View solution in original post

9 REPLIES 9
Highlighted
Ritika_Agarwal
Regular Visitor

Re: Filter by text box or drop down

Hi @ahhollan 

Yes, you can directly reference the filtered results into the Gallery Items. For doing so, please use the below expression and you should be able to get the required result.

Filter(Office365Users.SearchUser(),Or(TextInput4.Text in DisplayName, Dropdown1.Selected.Value in Department))

Here I have used the Office365Users.SearchUser() to get the details from the data source for the selected DisplayName/Department.


I hope this will resolve your concern! If yes, please mark it as closed, so that it will be beneficial for others too.

Community Support
Community Support

Re: Filter by text box or drop down

Hi @ahhollan 

 

You can reference @ahhollan 's suggestions.

Add one Gallery control, one textinput control,and rename the control as Gallery3, Textinput1

Gallery3.Items=Filter(Office365Users.SearchUser(),DisplayName = TextInput1.Text)    (you can use DisplayName and other properties as Id,Title ...)

textinput1.PNG

And if you want to use one dropdown control.

Dropdown.Items=Office365Users.SearchUser().DisplayName

Gallery.Items=Filter(Office365Users.SearchUser(),DisplayName = Dropdown.Selected.DisplayName)

 

More information:

control-gallery

function-filter-lookup

control-text-input

control-drop-down

 

Best Regards.

Yumia

View solution in original post

ahhollan Helper IV
Helper IV

Re: Filter by text box or drop down

I've altered the formula to Filter(Office365Users.SearchUser(),Or(InputEE.Text in DisplayName, Dropdown1.Selected.Value in Department)) .  However, when I test the app, I get no returned values. I placed the filter on Gallery>Items.

ahhollan Helper IV
Helper IV

Re: Filter by text box or drop down

I've updated the formula to Filter(Office365Users.SearchUser({searchTerm:"",top:500}),Department = Dropdown1.Selected.Result).  I now get a result, but only one record. How do I change this to get all people in the selected department?

Community Support
Community Support

Re: Filter by text box or drop down

Hi @ahhollan 

 

What is your dropdown's Items' formula expression?

Dropdown.Items=Office365Users.SearchUser().Department

DropDown.PNG

Then Gallery.Items=Filter(Office365Users.SearchUser({searchTerm:"",top:500}),Department = Dropdown.Selected.Department)

Gallery.PNG

 

Hope this could be helpful.

 

Best Regards.

Yumia

ahhollan Helper IV
Helper IV

Re: Filter by text box or drop down

I think my issue is in the number of rows limitation for non delegatable query functions. When I enter the limiter of top:500,  i get results, but very limited.  I'm thinking that it's only processing the first 999 rows and I can't get around the limitation. Please advise if you've found a way to get around this.

Community Support
Community Support

Re: Filter by text box or drop down

Hi @ahhollan 

 

Could you please change the 500 to 2000 to test (as next screenshot shows)?

Top500.PNG

 

Best Regards.

Yumia

 

TopShelf-MSFT Community Champion
Community Champion

Re: Filter by text box or drop down

Hi @ahhollan how are you progressing with this? 

 

@TopShelf-MSFT 

ahhollan Helper IV
Helper IV

Re: Filter by text box or drop down

I've been able to get the formula to return results. The problem is that even when I change the formula to look at the top 2000 rows, it still isn't reviewing the entire database which has approx. 12k rows. Is there a way around this?

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (6,118)