cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sachinsoni
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

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.

@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.

@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. 

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
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,687)