I have a gallery (Gallery1) and a Collection (Collection1).
Gallery1 has a list of users with email addresses
Collection1 is a table of users who are members of a Group, and each includes their email.
I want to change the colour of an icon, if the selected user in Gallery1 matches an entry in Collection1.
I've tried this, but clearly it doesn't work!
If(Collection1,Member.email = Gallery1.Selected.Email,Green,Red)
Solved! Go to Solution.
It looks like your collection has the following structure:
Collection1: [{
Email: [{
userPrincipalName: ""
}]
}]
You'll want this collection to be flatter, like so:
Collection1: [{
userPrincipalName: ""
}]
You should be able to change your function to this, to achieve the desired structure:
ClearCollect(Collection1, AzureAD.GetGroupMembers("6ac59a2e-*****-4f18-******-0f9b52cba5af").value.userPrincipalName)
Lastly, you can update your filter function to:
If(email in Collection1.userPrincipalName, Red, Green)
Let me know if this doesn't work.
To test if a user is in the collection, you'll want to use the "in" operator like so,
If(email in Collection1.email, Red, Green)
The above solution should work fine for you. If you want a complete overview of conditional formatting in PowerApps check out the linked video. I show some different things I do in this context to help you learn the basics.
Hi both, thanks for the rapid responses. Unfortunately that doesn't seem to work in my app.
I have tried this:
If('Gallery 1'.Selected.Email in Collection1.Email,Green,Red)
"Cannot automatically convert this text value into a table" (It highlights the first .Email as the culprit.
Can you confirm that Collection.Email is text? You might be receiving this error if the data in Collection1.Email is a nested table. If possible, could you send a snapshot of your collections table with anonymized emails?
I create the Collection using this:
ClearCollect(Collection1, {Email: AzureAD.GetGroupMembers("6ac59a2e-*****-4f18-******-0f9b52cba5af").value.userPrincipalName})
It looks like your collection has the following structure:
Collection1: [{
Email: [{
userPrincipalName: ""
}]
}]
You'll want this collection to be flatter, like so:
Collection1: [{
userPrincipalName: ""
}]
You should be able to change your function to this, to achieve the desired structure:
ClearCollect(Collection1, AzureAD.GetGroupMembers("6ac59a2e-*****-4f18-******-0f9b52cba5af").value.userPrincipalName)
Lastly, you can update your filter function to:
If(email in Collection1.userPrincipalName, Red, Green)
Let me know if this doesn't work.
Perfect - thanks!
User | Count |
---|---|
121 | |
88 | |
87 | |
75 | |
66 |
User | Count |
---|---|
215 | |
180 | |
138 | |
96 | |
82 |