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

Help with Search and Filters

Hi All, 

 

I am new to PowerApps and looking to use the the People screen for a directory in my workplace. I customized and it is looking good. However our O365 have many sister companies so the search is looking through all of the records. how can I make it look only into values where a condition is true for example only when companyname = ABC 

 

Do I change something here If(!IsBlank(Trim(TextSearchBox2.Text)), Office365Users.SearchUser({searchTerm: Trim(TextSearchBox2.Text) , top: 15})) This is the search results gallery Items value. 

 

I tried few things but not managing to fix it, hope you can help.

 

Thanks

Eihab 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Help with Search and Filters

Hi @Eihab ,

Do you want to filter your search results based on some conditions?

 

Based on the needs that you mentioned, I think the Filter function could achieve your needs. I have made a test on my side, please consider take a try with the following workaround:

Set the Items property of the Gallery to following:

 

If(
   !IsBlank(Trim(TextSearchBox2.Text)), 
    Filter(
             Office365Users.SearchUser({searchTerm: Trim(TextSearchBox2.Text) , top: 15}),
             CompanyName = "ABC"           // Type your Filter condition here
    )
) 

 

Please consider take a try with above solution, then check if the issue is solved.

 

The all avaiable properties which could be used as Filtered column in above formula, please refer to the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/connections/connection-office365-users#...

 

Best regards,

Community Support Team _ Kris Dai
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
Highlighted
Super User III
Super User III

Re: Help with Search and Filters

@Eihab 

Assuming this is your original code...

If(
    !IsBlank(Trim(TextSearchBox2.Text)),
    Office365Users.SearchUser({searchTerm: Trim(TextSearchBox2.Text),top: 15})
) 

 

...I think this could be achieved by applying a FILTER to ensure the email domain matches "@yourcompanyname.com"

 

If(
    !IsBlank(Trim(TextSearchBox2.Text)),
    Filter(
        Office365Users.SearchUser({searchTerm: Trim(TextSearchBox2.Text),top: 15}),
        "@yourcompanyname.com" in Mail
    )
) 

 

This approach worked when I tested it.  Please let me know if it works for you.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Community Support
Community Support

Re: Help with Search and Filters

Hi @Eihab ,

Do you want to filter your search results based on some conditions?

 

Based on the needs that you mentioned, I think the Filter function could achieve your needs. I have made a test on my side, please consider take a try with the following workaround:

Set the Items property of the Gallery to following:

 

If(
   !IsBlank(Trim(TextSearchBox2.Text)), 
    Filter(
             Office365Users.SearchUser({searchTerm: Trim(TextSearchBox2.Text) , top: 15}),
             CompanyName = "ABC"           // Type your Filter condition here
    )
) 

 

Please consider take a try with above solution, then check if the issue is solved.

 

The all avaiable properties which could be used as Filtered column in above formula, please refer to the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/connections/connection-office365-users#...

 

Best regards,

Community Support Team _ Kris Dai
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

Highlighted
New Member

Re: Help with Search and Filters

Thank you so much for the help. This worked like a charm 🙂

 

If(
!IsBlank(Trim(TextSearchBox2.Text)),
Filter(
Office365Users.SearchUser({searchTerm: Trim(TextSearchBox1.Text) , top: 15}),
CompanyName = "Name" // Type your Filter condition here
)
)

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,877)