Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

How do I filter Combobox to show emails domains when using Office365Users Data Source?

(0) ShareShare
ReportReport
Posted on by

Hi Power App Community,

 

I am trying to set my Combobox which is used to search for Office365 Users to show emails for two specific domains

Domain 1: @wellcome.org

Domain 2: @ippsecretariat.org

 

When I specify one domain it works with no problem but when I try to use a boolean function such as Or, And etc it breaks the combobox but likes the function as it gives no errors?.

 

Here is a screengrab of when it works fine with one domain.

Formula: Filter(Office365Users.SearchUser({searchTerm:ComboBox1.SearchText}),EndsWith(Mail,"@wellcome.org"))

Masum172_1-1685228477773.png

 

Here is when I try to use two domains using a boolean such as Or, And, & which it gives no errors but breaks combo box as doesn't display anything.

Formula: Filter(Office365Users.SearchUser({searchTerm:ComboBox1.SearchText}),EndsWith(Mail,"@wellcome.org"And"ippsecretariat.org"))

Masum172_2-1685228594556.png

 

If someone can kindly assist me with this I would be ever so grateful!

 

Thanks

  • Verified answer
    cha_cha Profile Picture
    cha_cha 4,904 on at
    Re: How do I filter Combobox to show emails domains when using Office365Users Data Source?

    Hello @Masum172 

     

    You can use a combination of the Nested With function and Ungroup function for this.

    With(
     {
     _domA: Filter(Office365Users.SearchUser({searchTerm:ComboBox1.SearchText}),EndsWith(Mail,"@wellcome.org")) ,
     _domB: Filter(Office365Users.SearchUser({searchTerm:ComboBox1.SearchText}),EndsWith(Mail,"@ippsecretariat.org"))
     },
     With(
     {
     _result: Ungroup(
     Table(
     {res: _domA},
     {res: _domB}
     ),
     "res"
     )
     },
     _result
     )
    
    )

     

    The code above filters user data from two different email domains using the Filter function, combines them into a table using the Table function, and then ungroups the table using the Ungroup function to obtain a single collection of individual records.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,445

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,741

Leaderboard