cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kriggo15
Responsive Resident
Responsive Resident

Comparing Items in 2 Galleries and highlighting matches

I want to be able to compare the content in two galleries and highlight the rows that exactly match. I can't seem to figure out the proper TemplateFill code to highlight accordingly. 

For example, col_1, col_10, col_11, and col_12 in the below screenshot should be highlighted for both galleries. I appreciate the help.

GalleryCompare.png

1 ACCEPTED SOLUTION

Accepted Solutions
kriggo15
Responsive Resident
Responsive Resident

Nevermind, we were able to figure out the solution listed below. I didn't originally realize I could go a Gallery.AllItems.XX. I hadn't seen anything listed after the AllItems before.

Solution:

 

If(ThisItem.Name exactin Gallery1.AllItems.Name, Green, White)

 

View solution in original post

5 REPLIES 5
FMontesRNX1
Resolver II
Resolver II

So you need to highlight the element based on the content and row order for the Text Input boxes? Why both are Text Input boxes? I guess both are unsaved elements or part of a collection? Or is controlled by Default value?
First you'll need to set row numbers to compare only between them, I'm not sure about your source but here a link (credits to owner):
Add A Row Number Column To A Collection - Matthew Devaney


Then you'll need to use that row index to compare.

Otherwise, if no matter the row order and you'll only compare between galleries values, you can test a condition based on Filter referenced to each Gallery, something like if(IsBlank(Filter(Gallery2.AllItems,TextInput2.Text = ThisItem.TextInput1.Text))
Please test, I didn't had a chance to test it by myself, but hope it helps

 

 

kriggo15
Responsive Resident
Responsive Resident

Thanks for the reply.

Order doesn't matter in this case. We just want to highlight the matches between both galleries. Additional note: the elements are not text input boxes, they are actually labels, but can see how they could appear that way.

FMontesRNX1
Resolver II
Resolver II

OK that's make all easier, did you had a chance to check the second suggestion?
Considering changes on labels instead text input boxes, try something like:

If(IsBlank(Filter(Gallery2.AllItems,Field2 = ThisItem.Field1)),Green,Red)

 Adjust condition based on your fields and data types

kriggo15
Responsive Resident
Responsive Resident

Thanks for the suggestion, but it didn't work as expected. It returned everything as Red.

kriggo15
Responsive Resident
Responsive Resident

Nevermind, we were able to figure out the solution listed below. I didn't originally realize I could go a Gallery.AllItems.XX. I hadn't seen anything listed after the AllItems before.

Solution:

 

If(ThisItem.Name exactin Gallery1.AllItems.Name, Green, White)

 

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (5,104)