cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Want to compare two collections

Hello experts,

 

I want to compare two collections. first collection have user Role matrix, and second collection has Current logged in user groups.

 

Role Matrix

RoleBasedMatrix.jpg

 

Current User Groups

 

Current User GroupsCurrent User Groups

 

I want to compare Current User Group collection with Role Matrix role column, means want to get list of all roles which current user having in second collection.

 

how can i achieve this, please help!

13 REPLIES 13
Highlighted

On the button's visible property, you can add this formula which will look into the filtered collection and find roles.

"President" in Filter('Role Matrix',Role in 'Current User Groups'.displayName).Role

which is the same as 

If(
"President" in Filter('Role Matrix',Role in 'Current User Groups'.displayName).Role,
true,
false)

You can then obviously change  "President" out with any role.

You can also drive it using your permission column like this

Not(IsBlank(Find("Approve",Filter('Role Matrix',Role in 'Current User Groups'.displayName).permission).Result))

Where you would change "Approve" to  any of the other permissions. This one looks more complicated because your permissions are one text field.

---
If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up.

Highlighted

@EricLott  I like your thinking 🙂 just learned a new thing will remember about IN next time^^ Thinking only about one thing if the below formula will be applied on every control it will always be triggered so n number of the controls n number of execution. 
Would suggest to store the result in the single var than assign it to visible. 

@sachinsoni Eric explanation is great:) hope you will move forward with it.

Highlighted

@365CornerDawid Yes, that's true.

@sachinsoni, It would be best to set a global variable for each check you plan on making.

Set(variableName,variableValue)

Where variableName would be the name you want to give it and variableValue would be one of the checks I showed above.

---
If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up. 

Highlighted

Hi @365CornerDawid ,

 

I have a similar issue in my application. 

 

How can i push the values that are not matching into another collection or append those values to a string.

 

Kindly advice.

 

Regards

Srinath

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,895)