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:
I expected to see the table of users right there. But they're buried under that value, here:
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.
Homerun. Thanks my semi-anonymous friend.
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!
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.
That seems logical and shows no error but when executed doesn't populate anything in the collection at all.
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!
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.
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!
Try this
ClearCollect(colTechTeam, Office365Users.DirectReportsV2("someone@somewhere.com").value)
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional