Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Combobox is not getting proper data from the Variable (Office365Users Connector)

(0) ShareShare
ReportReport
Posted on by 44

Hello everyone,

I ran into a weird issue and was hoping you could help. I don’t see anything wrong with my code at the moment, but I have checked multiple times and I’m scratching my head.

This is on the OnVisible property of the screen:

// Copying data from Connection to variable
UpdateContext({varUsers:     
    Filter(
        Office365Users.SearchUser({top: 999}),
        AccountEnabled
        && EndsWith(Mail, "@samplecompany.com")
        && Not(IsMatch(DisplayName, ".*\d.*"))
    )
})

This code stores the data into varUsers, and I checked the context variables under the same screen. It does have all the data I wanted.

Now, I set varUsers for the Item property of three comboboxes:


  • ComboBox1 item: varUsers

  • ComboBox2 item: varUsers

  • ComboBox3 item: varUsers

  •  

Here is the part I am struggling with:


  • ComboBox1 seems to ignore Not(IsMatch(DisplayName, ".*\d.*")) even though it is from the varUsers variable.

  • ComboBox2 and ComboBox3 seem to ignore all the filters except for AccountEnabled.

  •  

I tried this on another tablet and encountered the same issues. One of my colleagues tried the app and is seeing the same issue. If it matters, I am in my developer environment and do have access to the production environment.

I also tried this, but the same issues occurred:

// Copying data from Connection to variable
UpdateContext({varUsers:     
    Filter(
        Office365Users.SearchUserV2({top: 999}).value,
        AccountEnabled
        && EndsWith(Mail, "@samplecompany.com")
        && Not(IsMatch(DisplayName, ".*\d.*"))
    )
})

I also tried this, but the same issue persists:

// Copying data from Connection to variable
Set(varUsers,     
    Filter(
        Office365Users.SearchUser({top: 999}),
        AccountEnabled
        && EndsWith(Mail, "@samplecompany.com")
        && Not(IsMatch(DisplayName, ".*\d.*"))
    )
})
 

Thank you!

EDIT: Removed one line of code just in case for piracy concern.

  • Verified answer
    staronline1and2 Profile Picture
    44 on at
    Combobox is not getting proper data from the Variable (Office365Users Connector)
    I ended up asking copilot (bing.com) again. They told me to try all the steps which I already did. Then told me to use ClearCollect instead of UpdateContext or/and Set function. So I change it to what shown below.
     
    //Copying data from Connection to collection
    ClearCollect(colUsers,    
        Filter(
            Office365Users.SearchUser({top: 999}),
            AccountEnabled
            && EndsWith(Mail, "@samplecompany.com")
            && Not(IsMatch(DisplayName, ".*\d.*"))
        )
    );

    And change all three combobox items to colUsers and it is working as expected.
    This is what's solved my issue.
     
    For those are curious, this is message from copilot told me.
     

    "Collections in Power Apps can indeed handle data more efficiently in certain scenarios. Here are a few reasons why using a collection might help:


    1. Persistent Storage: Collections are stored in memory and can be accessed throughout the app, making them useful for managing data that needs to be reused across different screens or components.

    2. Performance: Collections can improve performance because they reduce the need to repeatedly query the data source. Once the data is loaded into a collection, it can be accessed quickly without additional calls to the server.

    3. Consistency: Using a collection ensures that the data remains consistent across different controls. Since the data is stored locally, it reduces the risk of discrepancies that might occur due to network latency or other issues.

    4. Flexibility: Collections offer more flexibility for manipulating and filtering data. You can easily add, remove, or update records in a collection, which can be useful for complex data operations.

    By using a collection, you might find that the data behaves more predictably and the filters are applied consistently across your comboboxes. Let me know if this helps or if you have any other questions! 😊"



     


     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,522 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,890 Most Valuable Professional

Leaderboard