web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Using a collection to ...
Power Apps
Answered

Using a collection to hold direct reports

(0) ShareShare
ReportReport
Posted on by 716 Moderator

So I have a really simple ClearCollect statement:

 

ClearCollect(colTechTeam, Office365Users.DirectReportsV2("someone@somewhere.com"))

 

This works a treat. But, for the life of me, I cannot determine how to now query against the contents of the collection.

When I look at it in the Editor, I see this:

DCHammer_0-1714412008392.png

I expected to see the table of users right there. But they're buried under that value, here:

DCHammer_1-1714412073138.png

What you're seeing is the first X columns in the Claims record for each user returned. I didn't bother showing all and left out the actual data.

In that data of course, is a 'mail' column. I want to compare values in that column to the current user but can't figure out how.

I was trying to use the below to create a filtered collection which will have 1 or 0 records depending on result.

 

ClearCollect(
 colFilteredTechTeam,
 Filter(colTechTeam, mail = varCurrentUserEmail)
)

 

But mail is not a valid column name in the colTechTeam collection.

Categories:
  • BhaskarDhone Profile Picture
    1,398 Super User 2026 Season 1 on at

    Try this

    ClearCollect(colTechTeam, Office365Users.DirectReportsV2("someone@somewhere.com").value)
  • Gochix Profile Picture
    1,937 Moderator on at

    @DCHammer ,

     

     

    ClearCollect(
     colFilteredTechTeam,
     Filter(Ungroup(colTechTeam,value),mail=varCurrentUserEmail))

     

     

    or do everything in one collection:

     

    ClearCollect(colTechTeam, Filter(Office365Users.DirectReportsV2("someone@somewhere.com").value,mail=varCurrentUserEmail))

     


    _____________________________________________________________________________________
    Please give a thumbs up if I resolved your issue! Please click Accept as Solution to close the topic!

  • DCHammer Profile Picture
    716 Moderator on at

    So I'm at least partway there since the following works:

    ClearCollect(
     colFilteredTechTeam,
     Filter(colTechTeam, varCurrentUserEmail in value.mail)
    )

     

    I'm having a little challenge testing because I'm not in the first collection so running OnStart results in colTechTeam populating correctly but the colFilteredTechTeam ends up empty. I'm going to assume it's going to build a collection that looks exactly like the first with only one row buried under 'value'.

     

    So I thought this would work on Visible property but doesn't:

    If(varCurrentUserEmail in colFilteredTechTeam.value.mail, true,false)

    I also tried this thinking I could grab the First row since there will only be one based on the way the collection is populated.

    If(varCurrentUserEmail = First(colFilteredTechTeam).value.mail, true,false)

    But even though I'm specifying a specific record and field for the comparison, PA still tells me I can't compare text and a table.

     

    Also, if anyone has a better suggestion I'm all ears.

    I'm just trying to hide some datacards and controls for everyone expect users that report to a specific manager.

     

  • Gochix Profile Picture
    1,937 Moderator on at

    @DCHammer ,

     

    I've updated my solution so have a look if that works better for you.
    _____________________________________________________________________________________
    Please give a thumbs up if I resolved your issue! Please click Accept as Solution to close the topic!

  • DCHammer Profile Picture
    716 Moderator on at

    That seems logical and shows no error but when executed doesn't populate anything in the collection at all.

  • DCHammer Profile Picture
    716 Moderator on at

    I think that's going to work actually but I'm not entirely sure what I'll compare on the visibility property.

    I think what's right is to compare varCurrentUserEmail to colFilteredTechTeam obviously but to .value, .email? Maybe I can just use trial and error with an end user.

     

    I also tried using the same filter condition you used to populate the second collection for visibility but I cannot figure out the syntax.

  • Verified answer
    Gochix Profile Picture
    1,937 Moderator on at

    @DCHammer ,

    If this solution is working for you:

    ClearCollect(colTechTeam, Filter(Office365Users.DirectReportsV2("someone@somewhere.com").value,mail=varCurrentUserEmail))

    then for the visibility property you need only:

    If(varCurrentUser in colTechTeam.mail,true)


    _____________________________________________________________________________________
    Please give a thumbs up if I resolved your issue! Please click Accept as Solution to close the topic!

  • DCHammer Profile Picture
    716 Moderator on at

    Homerun. Thanks my semi-anonymous friend.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 381 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 340

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard