cancel
Showing results for
Did you mean:
Helper III

## Comparing Two Gallery Controls

I have two lists and I want to highlight the value in list1 based on list2 values where list1.name match with list2.name, both lists are generating using Gallery Control.

let say I have two lists with two columns as below

Llist1, with name1 and number1, and List2, with the name2 and number2.

Now I want to highlight the number1 in List1 where List1.name1 equals List2.name2. both lists dynamically loading values in Gallery Control.

I like to do something like this below where I can match the list1.name1 with list2.name2 and than compre there values and highlight but it's not working.

ForAll(List1,If(name1 in List2.name2,If(number1 < number2,Color.Yellow,RGBA(0,0,0,0)),RGBA(0,0,0,0)))

Thanks,

-Sal

2 ACCEPTED SOLUTIONS

Accepted Solutions
Solution Sage

Hello,

What you can also try is:
Gallery1.TemplateFill = LookUp(Gallery2.AllItems,name1=name2,Red)

It's just an example.
It turns Red the color of the template in Gallery 1 only when when name1=name2 as you can see. You can add more conditions and more colors.
If you need more help let me know.

Solution Sage

Hello,

Great that you found your way. 🙂

Yes you can. You can move the value name1 in the Label control if it validates a condition. But you don't specify where is the Label control. Is it in Gallery2? If yes,
Gallery2.Label2.Text = If(LookUp(Gallery2.AllItems,name1=name2,true),name1,name2)
But you have a condition name1=name2,  name1 and name2 are the same and there no difference in the result. Just play with the expression above to accomplice what you need and if you need anything just give some extra info and I can help.

5 REPLIES 5
Solution Sage

Hello,

What you can also try is:
Gallery1.TemplateFill = LookUp(Gallery2.AllItems,name1=name2,Red)

It's just an example.
It turns Red the color of the template in Gallery 1 only when when name1=name2 as you can see. You can add more conditions and more colors.
If you need more help let me know.

Helper III

Thanks Mike, I try to add TemplateFill but it's not showing me that as an option with my Gallery Control. it's showing me TemplateHeight, Padding, Width etc.

Helper III

Thanks Mike, I just went over the Gallery Control properties and found TemplateFill, I added LookUp(Gallery2.AllItems,name1=name2,Red) and it worked.

Thanks,

-Sal

Helper III

Is  there anyway I can move the value in the Label control? lets say Gallery1.name1= Gallery2.name2, can I move the value name1 in to Label control if it validate the condition?

Solution Sage

Hello,

Great that you found your way. 🙂

Yes you can. You can move the value name1 in the Label control if it validates a condition. But you don't specify where is the Label control. Is it in Gallery2? If yes,
Gallery2.Label2.Text = If(LookUp(Gallery2.AllItems,name1=name2,true),name1,name2)
But you have a condition name1=name2,  name1 and name2 are the same and there no difference in the result. Just play with the expression above to accomplice what you need and if you need anything just give some extra info and I can help.

Announcements

#### Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

#### Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

#### 2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

#### Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (2,381)