cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kristenlee0306
New Member

Using galleries for buttons that correspond to second gallery items

Hello,

I am new to PowerApps, but have been able to create an app that has two galleries connected to two SharePoint lists - one that is a list of three buttons - low, medium and high - and the second gallery which displays a list of resources. The list of resources is categorized by the complexity level. Therefore, when you click the "Low" button, only resources that are categorized as "Low" will appear. However, when you click the "Medium" button, resources for both "Low" and "Medium" will appear. Thus, the "High" view shows all resources for each level.


I want to have each button turn a different color when clicked, and then for the background of the resources rows that correspond to that button categorization also change to that color. (For example, when you click on "Low" the button will turn pink, and the background of all corresponding items in the resources gallery will also turn pink.) However, this means that I would want the "High" button to display three different colors to represent the level of complexity that each button represents. (i.e., Low = pink, Medium = green, High = red and clicking on the "High" button would show all these colors.)

 

Is this even possible? I've included a screenshot below of the current view of my app for reference:

kristenlee0306_0-1603387106147.png

Thank you!

4 REPLIES 4
PowerRanger
Resolver II
Resolver II

Hi @kristenlee0306 ,

 

first of all you need to set a variable to identify which Button was clicked. So on each Button OnSelect Property you need to apply a Set function:

 

 

Button Low OnSelect Property:
Set(selectedCompexity,["Low"])

Button Medium OnSelect Property:
Set(selectedCompexity,["Medium","Low"])

Button High OnSelect Property:
Set(selectedCompexity,["high","Medium","Low"])

 

 

In addition you need to set the Fill Property of each Button:

 

Button Low Fill Property:
If("Low" in selectedCompexity,Pink,RGBA(56, 96, 178, 1))

Button Medium Fill Property:
If("Medium" in selectedCompexity,Green,RGBA(56, 96, 178, 1))

Button High Fill Property:
If("High" in selectedCompexity,Red,RGBA(56, 96, 178, 1))

 

 

Last you need to to set the TemplateFill Property of the Gallery Contol. In my Case I have a field called complexity in my datasource:

 

 

Switch(
    ThisItem.Complexity,
    "Low",
    Pink,
    "Medium",
    Green,
    "High",
    Red
)

 

 

Thats it. Please try and let me know if this meets your requirement.

I'm sorry to be dense, but how do I set the "OnSelect" properties of each button when they are located in a gallery? I know how to set that for the Low button, but how do I set it for the medium and high options?

 

I really am trying to learn this new application so I do apologize for the dumb question.

Hi @kristenlee0306 

 

Is there a special reason why you use a gallery to show the buttons? Why do you not just place them on the screen?

 

@kristenlee0306 

 

If there is a good reason to have a Gallery to show the button you need to put the formulas in a switch statement.

 

switch(ThisItem.buttonComplexity,"Low",<code for low>,"Medium",<code for medium>,"High",<code for high>)

 

This applies for OnSelect as well as Fill

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

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.

Top Solution Authors
Top Kudoed Authors
Users online (1,528)